Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: variable number of arguments

From: lmecir:mbox:vol:cz at: 27-Nov-2000 9:57

Hi Larry, you *are* correct, of course, but your list is not complete.
> Hi Andrew, Ladislav > > This example may help resolve the question in a direct fashion. We can use > do/next to identify the first expression in a block. > > >> x: 1 y: 2 z: 3 > == 3 > > >> do/next [do x y z] > == [1 [y z]] > > This shows that the inner do consumed only one argument. > > >> take2: func [x y] ["hello"] > >> do/next [take2 x y z] > == ["hello" [z]] > > This shows the function take2 consumed (as expected) two arguments. > > Cheers > -Larry >
take-n: func [n /local spec] [ spec: copy [] for i 1 n 1 [ append spec to word! append copy "a" to string! i ] func spec reduce [:reduce append reduce [to lit-word! append copy "take" to string! n] spec] ] do/next [do take-n 4 1 2 3 4 5] == [[take4 1 2 3 4] [5]] shows, that Do took 5 arguments here, IMO. Regards Ladislav