Rebol Tutorial
Rebol Tutorial

Reputation: 2754

Rebol function and unlimited arguments

The do function in rebol seems to accept unlimited arguments. Can I do that with my own function (without using a block of arguments) ?

Upvotes: 3

Views: 464

Answers (2)

Ladislav
Ladislav

Reputation: 987

You are right, that in REBOL there are variadic functions, an example being the DO function. In R2, even the MAKE function is variadic. Nevertheless, the function specification dialect does not allow you to define your own variadic function, and such a feature isn't even planned.

Upvotes: 2

Peter W A Wood
Peter W A Wood

Reputation: 853

It is not possible to define a function with a variable number of arguments. The last message in this Rebol Mailing List thread http://www.rebol.org/ml-display-thread.r?m=rmlDTXB has an explanation.

Also the do function takes a single argument:

>> ? do
USAGE:
    DO value /args arg /next 

DESCRIPTION:
     Evaluates a block, file, URL, function, word, or any other value.
     DO is a native value.

ARGUMENTS:
     value -- Normally a file name, URL, or block (Type: any)

REFINEMENTS:
     /args -- If value is a script, this will set its system/script/args
         arg -- Args passed to a script. Normally a string. (Type: any)
     /next -- Do next expression only.  Return block with result and new position.

Upvotes: 3

Related Questions