Nargs returns the actual number of arguments depending upon your
invocation:

e.g. nargs  'open/lines 
or nargs 'open/lines/binary

etc. with "object" detection. As you can see it is a Rugby excerpt.

--Maarten

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of
> A J Martin
> Sent: vrijdag 17 oktober 2003 12:41
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Re: nargs
> 
> 
> 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/
> -><-
> 
> --
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.


-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to