Tagged as challenge
Written on 2018-01-30
Write define-curried
which defines a curried function. That is,
(define-curried-function (clog b x)
(/ (log x) (log b)))
will define clog
so that it's equivalent to:
(lambda (b)
(lambda (x)
(/ (log x) (log b))))
Note: This is difficult or impossible to write in full generality in some languages.
Write a combinator called $\mathrm{curry}_n\,f$ which takes a function $f$ of $n\ge 1$ arguments, and produces a fully curried version of $f$. (If you can compute $n$ from $f$, when you may elide $n$ as an argument.) It should satisfy the following equations: