Three cheers for Oliver! - he succeeded to circumvent the GC fault - which I
was blind enough not to see.
Ladislav
Rebol [
Title: "Curry"
Date: 6/12/1999
File: %curry.r
Version: 1.0.0
Author: ["Ladislav Mecir" "Oliver Schaefer" "Gabriele Santilli"]
Email: [[EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]]
]
curry: func ["Create curried functions" [catch]
fnc [any-function!] "Function to be curried"
args [block!] "Arguments of the curried fnc"
/local formargs restargs nonargs original
][
formargs: first :fnc
if not empty? nonargs: difference/only args formargs [
throw make error! compose/deep [
script expect-set [(formargs)] [(nonargs)]
]
restargs: difference/only formargs args
original: append compose [(:fnc)] formargs
func args reduce ['func restargs original]
]