Thanks to you all,
Christophe, Cyphre, Volker, Anton and indirectly others too for your comments and
vision about how to effectively use REBOL for
solving the daily challenges we all have as "programmers" ...
Your solutions will be studied diligently since they also showed me other interesting
Of course, one has to be careful that the result of the
expression following this "magical" function does not
get eaten up by mistake. In this case, you should wrap
in parens. Example (imagine in a script):
(f 1)
; now let's do some real work
; lots of comments...
On Dienstag, 6. April 2004 11:13, Robert M. Münch wrote:
> On Tue, 6 Apr 2004 08:12:01 +0200, Coussement Christophe
>
> <[EMAIL PROTECTED]> wrote:
> > I once use this little trick for handling a variable number of argument:
> >
> > f: func [a [integer!] b [unset! integer!]][either value? 'b [a + b
On Tue, 6 Apr 2004 08:12:01 +0200, Coussement Christophe
<[EMAIL PROTECTED]> wrote:
> I once use this little trick for handling a variable number of argument:
>
> f: func [a [integer!] b [unset! integer!]][either value? 'b [a + b][a]]
Hi, clever! This is a very cool trick... I hope I remember
- Original Message -
From: "Coussement Christophe" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 06, 2004 8:12 AM
Subject: [REBOL] Re: [Function] with [Variable number of args]
>
> Hi Gerard,
>
> I once use this little trick for handling a
Hi Gerard,
I once use this little trick for handling a variable number of argument:
f: func [a [integer!] b [unset! integer!]][either value? 'b [a + b][a]]
>> f 1 2
== 3
>> f 1
== 1
Please remark that the type of the argument must be explicitely declared, otherwise:
f: func [a b][either value
> 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.
slim includes (as part of its basic toolset) a very advanced print mechani
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
>
>
> Can someone tell me if there is one simple way to do this
> with REBOL or if I have to define another independant
> function to do this.
no.
AFAIK rebol does not handle variable number of arguments, simply because it cannot
know where a specific word should stop using values.
rebol can
Hi Gerard,
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
10 matches
Mail list logo