[REBOL] Re: Functional programming in REBOL
From: lmecir:mbox:vol:cz at: 7-Aug-2001 13:03
Hi myself,
> In http://www.sweb.cz/LMecir/highfun.r I call such a function E-FUNC. The
> difference is, that E-FUNC is neither shorter, nor more elegant, but "more
> general" in some aspects, e.g. it supports datatype checking and doesn't
> have trouble with "active arguments" like functions, words, paths, ...
Larry, your CFUNC doesn't have trouble with "active arguments". Some
differences:
f1: e-func [x [any-type!]] [type? get/any 'x]
f1 () ; == unset!
while
g1: cfunc [x [any-type!]] [type? get/any 'x]
** Script Error: Expected one of: word! - not: block!
** Where: to-get-word
** Near: to get-word! :value
f2: e-func [:x] [type? get/any 'x]
f2 // ; == op!
while
g2: cfunc [:x] [type? get/any 'x]
g2 // ; == get-word!
f3: e-func [do] [type? get/any 'do]
f3 "OK" ; == string!
while
g3: cfunc [do] [type? get/any 'do]
g3 "OK" ; == [func [do][type? get/any 'do] :do]
Cheers
Ladislav