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

[REBOL] Re: func args by ladislav

From: lmecir:mbox:vol:cz at: 16-Oct-2001 16:35

Hi Romano, I don't think, I must change your mind, but there is a difference you probably don't see. It is possible to define a Rebol function (a FUNCTION! datatype value to be exact), that takes one argument and evaluates it: do-f-0: func [f] [ f ] 1) DO-F-0 is able to evaluate any zero-argument function supplied as the F argument. 2) DO-F-0 is unable to evaluate any one-or-more-argument function supplied as the F argument Similarly it is possible to define a function that takes two arguments and evaluates the first one supplying it the second one as its argument: do-f-1: func [f arg1] [ f :arg1 ] do-f-2: func [f arg1 arg2] [ f :arg1 :arg2 ] etc. 3) I think, that we are in agreement, how many arguments the above defined functions take. It is evident, that for a Rebol function to evaluate its F argument, the function must take n + 1 arguments, where n is the number of arguments of F. 4) Can you write a Rebol function (a FUNCTION! datatype value) able to evaluate any F (i.e. F with any number of arguments) without cheating, i.e. without "packing" the arguments into a block? Cheers Ladislav