From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Nicolas Petton Newsgroups: gmane.emacs.devel Subject: Re: Is there a function for auto currying in Elisp? Date: Fri, 22 Dec 2017 10:14:31 +0100 Message-ID: <87efnnm8eg.fsf@petton.fr> References: <87tvwki1oe.fsf@petton.fr> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Trace: blaine.gmane.org 1513933995 32405 195.159.176.226 (22 Dec 2017 09:13:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 22 Dec 2017 09:13:15 +0000 (UTC) To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 22 10:13:11 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 1eSJOA-0008AL-Mc for ged-emacs-devel@m.gmane.org; Fri, 22 Dec 2017 10:13:10 +0100 Original-Received: from localhost ([::1]:41112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSJQ8-0001Jy-VJ for ged-emacs-devel@m.gmane.org; Fri, 22 Dec 2017 04:15:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSJPa-0001Jl-LP for emacs-devel@gnu.org; Fri, 22 Dec 2017 04:14:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSJPX-0008P6-A7 for emacs-devel@gnu.org; Fri, 22 Dec 2017 04:14:38 -0500 Original-Received: from petton.fr ([89.234.186.68]:49352) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eSJPW-0008Oc-VX for emacs-devel@gnu.org; Fri, 22 Dec 2017 04:14:35 -0500 In-Reply-To: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=petton.fr; s=mail; t=1513934073; bh=mqXqmB0C9XYCm/nS99HcuyY7TzwlJsD9pL7gyZHRhFk=; h=From:To:Subject:In-Reply-To:References:Date:Message-ID:MIME-Version:Content-Type; b=o+JNzxiIkDCt05OiyPtMFdIapSoWovtvizJ8vxt+rw27Tr4uwdy8Yz5v/wiqicz9nFH2yGQkNnmwlLHDqnC0l2GtMgIrSIKpWrDjC1EE4veJ2A3ozCBOh74u5dhazGIeFW2wlDlu/JE5rNFKuodmSMCOAGX9vZ5/+Y6CWSIxhq0= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 89.234.186.68 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:221328 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier 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 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEKNO+2FH986tX/vk8IzWHpHwgeRAFAlo8zPcACgkQIzWHpHwg eRCmHggAyX3igOIK1kyOUT7G3abA+4OYBAs3XiALbtoVWAQKh5PGXynfLcks9XHv bK2gnDta5sPDLLtgzrqWr9PGdoNdbv9tJ97CI8ZKbKOXxkI0LZY+2jZVIUl7ZQma BdkbqYl+/5rhcVho9V6FxsC2bDVAPqkaz8pSi9UQ6+KLGIbu7/afYls1oiadSMQH hxrnwHdiA1WVmf71IXz02VDmhOAgxp/m2CIQAcI14+/LyettZKBcQUAneXJ7+g8L akkTSCxnZrl/FYM591MuthQpxvgIKvRYXQ0RMqlsAafqjiq0/edzYAaiwKn9mEk8 z6aNJMiTvvhQW0dhVQFvlju4cD0snw== =0taM -----END PGP SIGNATURE----- --=-=-=--