From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Is there a function for auto currying in Elisp? Date: Thu, 21 Dec 2017 11:50:16 -0500 Message-ID: <1c536593-851a-19b4-3941-a7e9c624ad8c@gmail.com> References: <87tvwki1oe.fsf@petton.fr> <87r2rohxey.fsf@petton.fr> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1513874919 23585 195.159.176.226 (21 Dec 2017 16:48:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 21 Dec 2017 16:48:39 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 21 17:48:35 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eS41J-0005aj-Ie for ged-emacs-devel@m.gmane.org; Thu, 21 Dec 2017 17:48:33 +0100 Original-Received: from localhost ([::1]:58956 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eS43H-000672-Sm for ged-emacs-devel@m.gmane.org; Thu, 21 Dec 2017 11:50:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eS431-00061K-K6 for emacs-devel@gnu.org; Thu, 21 Dec 2017 11:50:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eS430-0000wR-JV for emacs-devel@gnu.org; Thu, 21 Dec 2017 11:50:19 -0500 Original-Received: from mail-qt0-x235.google.com ([2607:f8b0:400d:c0d::235]:43762) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eS430-0000vq-Eg for emacs-devel@gnu.org; Thu, 21 Dec 2017 11:50:18 -0500 Original-Received: by mail-qt0-x235.google.com with SMTP id w10so33119070qtb.10 for ; Thu, 21 Dec 2017 08:50:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=2LCi6FtWNtW4mTXlnu3OhRsI0+ZCLm4O1++djaVaL1Q=; b=tCBdXMZpZoJWfSnacyvzfPsxQfwhO7kLEHmCyVSdbjruGrcbG4jXpUGw58ZCQOlxsG yA/heLTSBD/VpTt76TEpErPqQYyvB8mERWVbLd/5CJd3nwq6A7PNNhI8f/F9ASCPCJy4 +ju+oZpYzC3SmcZqTFfDKt6otzCyKT5Gyg1N5Aa5g3gNOjB/cy0U/qlDJMcNGz2IwbZb LghPUKP5ku6xIZoBfXB3xnZiYqmoM8wPI4V3hS0ytRTAIheU5mZFMb48QvdterxiiJ7i oloy52sB6oa3wjE2sIyMw6vMmG7DXzHagffrSBPHjWpRRcrH3imGPJh+xkTXCu4+QaVF 4v5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2LCi6FtWNtW4mTXlnu3OhRsI0+ZCLm4O1++djaVaL1Q=; b=r2O2TgFhW6DzGP3PYXGrkscflp30f88h0WrUq8Qy2d1UJmP6rwD7IkoyLZExyDrZu2 A3y5cuYhIWat/qV5rEs6DO7a0wv7o1ZifHpTx218wrq1zErBZmjgVTDhzbsGdmtBNnGQ NUOaSx7d3u20g99x28KRtyvvtWW3Zg6OPvax16v5RjSSBxjKAnTG9q2tMWunDoGP5VtS ALr/XPe6BDWS9dDnuGaobVZu8iCcqBIzjyGsjbye92rV8SbssuAYhUnZyQLzoelhNT9e EU6fXLUsP2cr7Kkli96eXIh0wcsmPJSA0gtqryvuIvZ0MO23v00vRcck7ei8vivjrOBB yVHQ== X-Gm-Message-State: AKGB3mJ7ZH7D2b24Ed+YOJqoDqyrqbaMBQHG2+z0itbh5DsUk+UNQt/P gdxy3DmT3eO28O+AlrWiirN6MHlt X-Google-Smtp-Source: ACJfBouk9zg6Kns19zf2LSehZ5Z8X6qgy1E2d6sUspD7S1KQp6zAnSCdop5uyJbUWZhlXsTJoKYN8A== X-Received: by 10.237.60.129 with SMTP id d1mr16780956qtf.288.1513875017387; Thu, 21 Dec 2017 08:50:17 -0800 (PST) Original-Received: from ?IPv6:2601:184:4180:66e7:e873:71b4:4fbc:d9e2? ([2601:184:4180:66e7:e873:71b4:4fbc:d9e2]) by smtp.gmail.com with ESMTPSA id l188sm2131455qkd.36.2017.12.21.08.50.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Dec 2017 08:50:16 -0800 (PST) In-Reply-To: <87r2rohxey.fsf@petton.fr> Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::235 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221303 Archived-At: On 2017-12-21 11:13, Nicolas Petton wrote: > Philipp Stephani 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.