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

[REBOL] Re: func args by ladislav

From: joel:neely:fedex at: 16-Oct-2001 12:13

Hi, Romano, Romano Paolo Tenca wrote:
> Upto here, we agree. Functions have a fixed number of args. Right? >
No, not AFAICT...
> I don't understand. If the answer is no, functions have always a fixed number > of args, like i think. > You think that this is false. So, you should be able to write this kind of > function. Right? >
Here's a function with a varying (within bounds) number of args... zzz: func [a [any-type!] b [any-type!]] [ either value? 'a [ either value? 'b [ print ["Foo with" a "and" b] ][ print ["Foo with just" a] ] ][ print "Just foo!" ] ] ... which behaves as follows ...
>> zzz
Just foo!
>> zzz 1
Foo with just 1
>> zzz 1 2
Foo with 1 and 2 Of course, this is not a completely unbounded number of arguments, but it is not absolutely fixed. -jn- -- This sentence contradicts itself -- no actually it doesn't. -- Doug Hofstadter joel<dot>neely<at>fedex<dot>com