[EMAIL PROTECTED] wrote:
> ...
> To show some examples:
> 
> you cannot create a curried function in Rebol (- even though you can easily
> write it in Rebol), you cannot define a composition function, i.e. this:
> 
> o: func [f [function!] g [function!]] [func [x] [f g x]]
>...

The following composition function appears to work, AFAICT...

    >> double: func [i] [i + i]
    >> double 7
    == 14
    >> add1: func [i] [i + 1]
    >> add1 7
    == 8
    >> onto: func [:f :g] [func [i] [f g i]]
    >> do (onto add1 double) 7
    == 15
    >> do (onto double add1) 7
    == 16

IMHO the problem is NOT that I cannot CREATE the composition function,
but that I cannot STORE it for later use.  I can do this:

    >> test1: onto add1 double
    >> test1 7
    == 15
    >> test2: onto double add1
    >> test2 7
    == 16

which appears to be working just as expected, but then the next use
of 'test1 (copied from the next line of my console transcript)
behaves NOT as expected:

    >> test1 7
    == 16

Hmmmm...  Something about 'onto only having a single context (with
only one meaning at a time for 'f and 'g) which is simply referred to
by both 'test1 and 'test2 is my current understanding of what's
happening here.

Any enlightment from the gurus welcomed!

-jn-

Reply via email to