[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there a function for auto currying in Elisp?
From: |
Nicolas Petton |
Subject: |
Re: Is there a function for auto currying in Elisp? |
Date: |
Fri, 22 Dec 2017 10:14:31 +0100 |
Stefan Monnier <address@hidden> writes:
> So, I think we can't magically handle all cases.
Definitely not for functions that take &rest params.
> Of course, we can do the easy cases:
>
> (defun curry (f n)
> (if (< n 2)
> f
> (lambda (x)
> (curry (apply-partially f x) (- n 1)))))
That's exactly the implementation I was playing with yesterday :-)
> but ... I'm not sure we want to encourage this.
Why not?
> What's your use case(s)?
I don't have a specific use case right now, but I think that currying
can be very expressive and elegant, and fits extremely well with
functional programming, which Elisp is very capable of.
Cheers,
Nico
signature.asc
Description: PGP signature
Re: Is there a function for auto currying in Elisp?, vlnx, 2017/12/21
Re: Is there a function for auto currying in Elisp?, Stefan Monnier, 2017/12/21