[REBOL] Re: nargs
From: AJMartin:orcon at: 24-Dec-2003 22:41
Maarten wrote:
> Here is a nargs function that also counts the optional arguments if you
use refinements (e.g. nargs copy == 1 nargs copy/part == 2).
> [Snip large chunk of code.]
Ouch! That's a large amount of code.
Isn't this easier?
>> length? Arguments :copy
== 1
>> source Arguments
Arguments: func [
{Returns the arguments of the function as a block of word! values.}
F [any-function!] "The Function"
][
head clear any [
find first :F refinement!
tail first :F
]
]
And if one needs the length of a path:
>> length? 'copy/part
== 2
Or perhaps I've misunderstood something?
Andrew J Martin
Grail Jedi
ICQ: 26227169
http://www.rebol.it/Valley/
http://valley.orcon.net.nz/
http://Valley.150m.com/