Hi Ladislav,
thank you for being so responsive.
>[L]
>Ah, you didn't look at my description of the second argument?
Sorry, I was in a hurry and actually didn't. I think both versions - with
and without additional argument block have a place in my big heart ;-) -
and could easily be combined in one function using refinements.
>
>Don't worry, I looked how you did it and modified my version accordingly:
>
>curryfirst: func [fnc [any-function!]
> /local formargs firstarg original
> ] [
> formargs: first :fnc
> if empty? formargs [return none]
> original: compose [(:fnc) (formargs)]
> func compose [(first formargs)] compose/deep [func [(next formargs)]
>[(original)]]
> ]
>
>[/L]
>
Cool. How the problem I reported with respect to the curry function
persists here as well:
>> addc: curryfirst :add
>> add5: addc 5
>> add5 5
== 10
>> add10: addc 10
>> add10 5
== 15
>> add5 5
== 15
Once I've created add10, add5 5 returns 15, even thought the correct answer
would have been 5.
That's because curryfirst's argument x - is now bound to the value 10 and
therefore add5's x is resolved to 10, like add10's x.
Take Care,
Elan