| Arc3's ac.scm has some support for currying, but it's not exposed. I put together some simple curry and reversed-curry combinators which seem fairly usable. (def on-rep (f x)
(annotate (type x)
(f (rep x))))
(def papply (f args-key)
(let wrap [fn args
(apply _ (args-key args))]
(case (type f)
mac (on-rep wrap f)
fn (wrap f)
(err "Can't curry:" f))))
(defs
>_ (f . xs) (papply f [+ xs _])
_< (f . xs) (papply f [+ _ xs]))
Trivial example: (= dup (>_ n-of 2))
|