Home   Archive   Permalink



Function Arity

It seems as though there is no way to handle variable arguments in Rebol.
For functions that take one or more arguments, is there an implicit [] wrapping the args?
    
My brain thinks of Argument count (argc) and Argument vector (argv), for something called on the command line.
    
Is Rebol, in fact, single Arity?
If it is, does it use Currying at the system level to form the illusion of multiple Arity?
    
If this was a func, I would think that you would be able to reason about, and manipulate the blocks.
    
myFunc: func [blks][
...
]
    
myFunc: [1 2 3] [x y z] [2 4 6]

posted by:   Gus (gt)       18-Aug-2013/14:00:43-7:00



Gus,
    
For that situation, why not pass a block, and handle the block as needed, inside the function?
    
R E B O L []
    
myFunc: func [blks] [
     foreach blk blks [
         count: 1
         foreach b blk [
             print rejoin ["Item #" count " in " mold blk ": " b]
             ++ count
         ]
     ]
]
    
myFunc [[1 2 3] [x y z] [2 4 6]]
halt

posted by:   Nick       21-Aug-2013/8:32:54-7:00