Variable Arguments

Jeremy Cowgar jeremy at cowgar.com
Fri Aug 22 14:09:46 UTC 2008


I'm sorry to be so needy right now. In time I'll get some of this down.
Right now I am reading on Page 73 of the manual
(http://isaacproject.u-strasbg.fr/download/Lisaac_RM_03.pdf) and it
speaks of Variable-argument lists (3.6.4). It has an example:

- add list:FIXED_ARRAY[INTEGER] <-
(
  (list.lower).to (list.upper) do { j:INTEGER;
    add_last (list.item j);
);

I've created a simple use of this with the min function I am trying to
make work. Here is my entire code:

Section Header

    + name := MYMIN;

Section Private

    - min_integer args:FIXED_ARRAY[INTEGER] <-
    (
        + least:INTEGER;
        least := INTEGER.maximum;
        args.foreach { el:INTEGER;
            ( el < least ).if { least := el; };
        };
        least.print;
    );

Section Public

    - main <-
    (
        min_integer(1,2,3);
    );

When I compile this, I get the following errors:

$ lisaac mymin.li
Depending pass: ..--SEMANTIC---------
Incorrect vector size.
Line 7 column 19 in MYMIN(./mymin.li):
    - min_integer args:FIXED_ARRAY[INTEGER] <-
                      ^

Line 21 column 14 in MYMIN(./mymin.li):
        min_integer(1,2,3);
                    ^

Any thoughts?

Jeremy




More information about the Lisaac-devel mailing list