From: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Is there a function for auto currying in Elisp?
Date: Thu, 21 Dec 2017 11:50:16 -0500 [thread overview]
Message-ID: <1c536593-851a-19b4-3941-a7e9c624ad8c@gmail.com> (raw)
In-Reply-To: <87r2rohxey.fsf@petton.fr>
On 2017-12-21 11:13, Nicolas Petton wrote:
> Philipp Stephani <p.stephani2@gmail.com> 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")
apply-partially is the closest you'll get, I think.
next prev parent reply other threads:[~2017-12-21 16:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 14:41 Is there a function for auto currying in Elisp? Nicolas Petton
2017-12-21 15:36 ` Philipp Stephani
2017-12-21 16:13 ` Nicolas Petton
2017-12-21 16:50 ` Clément Pit-Claudel [this message]
2017-12-21 16:56 ` Nicolas Petton
2017-12-21 17:22 ` Clément Pit-Claudel
2017-12-21 18:00 ` Nicolas Petton
2017-12-21 16:48 ` vlnx
2017-12-21 21:04 ` John Wiegley
2017-12-21 19:13 ` Stefan Monnier
2017-12-22 9:14 ` Nicolas Petton
2017-12-22 13:51 ` Stefan Monnier
2017-12-22 15:34 ` Nicolas Petton
2017-12-26 18:56 ` John Wiegley
2017-12-22 15:38 ` Nicolas Petton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1c536593-851a-19b4-3941-a7e9c624ad8c@gmail.com \
--to=cpitclaudel@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.