[REBOL] Re: [Function] with [Variable number of args]
From: gerardcote:sympatico:ca at: 5-Apr-2004 19:52
Hi Ashley and Maxim,
From Ashley:
> Two ways of passing a variable number of arguments [that I know of] are
> blocks and refinements. Block usage:
>
> f: func [v [integer! block!]][...]
>
> f 1
> f [1 2]
>
> or refinements:
>
> f: func [v1 [integer!] /var v2 [integer!]][...]
>
> f 1
> f/var 1 2
>
=======================
From Maxim:
=========
AFAIK rebol does not handle variable number of arguments, simply because it cannot know
where a specific word should stop using
values.
rebol can only use a variable number of arguments if you use a refinement, to let it
know that additional values are needed. each
refinement specifiying how many additional tokens it will use up.
=========================
Thanks for the information. I will try to figure how to do it the best I can with some
combination of refinements and blocks I
think.
And then later - when time will permit - with my own dialect too, as Maxim suggested.
If I am satisfied enough with the result, I'll also try to create some APL-like libray
of simple Math functions to extend current
REBOL calculations for use with 2 dimensional arrays "à la manière d'APL" but using Slim
as the librarian so I can try to redefine
the habitual arithmetics operators + - / * to include these extensions.
I have already seen somebody here redefine the REBOL PRINT for use its own PRINT substitute
with extensions instead and when leaving
his own context put back the normal PRINT so everything seems normal after.
Thanks again.
Regards,
Gerard