But not so nice if you do (define never-call-this (curry (letrec ((f
(lambda (x) (f x)))) f) x)).

On Thu, May 28, 2009 at 2:09 PM, Eduardo Cavazos <[email protected]> wrote:
>
>> On May 27, 2009, at 3:21 AM, Eduardo Cavazos wrote:
>>
>>> I have a feeling the above can be simpler...
>
> Abdulaziz Ghuloum wrote:
>
>> (define-syntax curry
>>  (syntax-rules ()
>>    [(_ proc x) (lambda (x) (proc x))]
>>    [(_ proc x x* ...)
>>     (lambda (x)
>>       (curry (lambda (x* ...) (proc x x* ...)) x* ...))]))
>
> What about:
>
> (define-syntax curry
>  (syntax-rules ()
>    [(_ proc x) proc]
>    [(_ proc x x* ...)
>     (lambda (x)
>       (curry (lambda (x* ...) (proc x x* ...)) x* ...))]))
>
> I.e. the first clause is simplified. Seems to work. So maybe *this* is the
> one from The Book. :-)
>
> Ed
>

Reply via email to