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

[REBOL] Re: nargs

From: cyphre:seznam:cz at: 17-Oct-2003 13:02

Hi Maarten, Not sure if this is better/complete solution version but I just hacked for fun simmilar function with the same functionality and it also proper counts the /local words ;-) example:
>> nargs 'copy
== 1
>> nargs 'copy/deep
== 0
>> nargs 'copy/part
== 1
>> nargs 'copy/local
== 0
>>
--------------------start of code-------------------------- nargs: func [f [word! path!] /local loc? ref? args refs fn rf][ fn: either word? f [ get f ][ rf: to-refinement first next to-block f get first f ] args: copy [] refs: copy [] parse third :fn [ any [ set w word! ( either ref? [ insert tail last refs w ][ insert tail args w ] ) | m: refinement! ( ref?: true insert tail refs reduce [m/1 copy []] ) | skip ] to end ] return either rf [ length? any reduce [select refs rf []] ][ length? args ] ] -------------------end of code-------------------------------- enjoy it, Cyphre