[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: |
Thu, 21 Dec 2017 17:13:09 +0100 |
Philipp Stephani <address@hidden> writes:
>> I've been looking for a function that would automatically curry its
>> argument, but couldn't find it. Maybe I just missed it?
>>
> apply?
I'm looking for function that would curry arguments, as opposed to a
partial application.
For instance, it would transform a function that takes A B and C as
parameters into a closure like:
(lambda (a)
(lambda (b)
(lambda (c)
(funcall f a b c))))
(Meaningless) example:
(let ((people '(((name . "Bob") (age . 21))
((name . "John") (age . 32))))
(get (curry #'alist-get)))
;; Retrieve all names
(mapcar (funcall get 'name) people)) ;; => ("Bob" "John")
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