220 36523 <d72691d1-58e5-474e-8b7d-07a29d73ddad@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicolas Lesser <blitzrakete@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Currying or Partial Application
Date: Sat, 6 Jan 2018 13:57:10 -0800 (PST)
Lines: 77
Approved: news@gmane.org
Message-ID: <d72691d1-58e5-474e-8b7d-07a29d73ddad@isocpp.org>
References: <835cc86a-2e6c-4e17-aec7-4f16cf8b085f@isocpp.org>
 <7A4EE214-FE5B-4EC2-BE9E-23522F55EE5B@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_121_296914613.1515275830924"
X-Trace: blaine.gmane.org 1515275719 19935 195.159.176.226 (6 Jan 2018 21:55:19 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 6 Jan 2018 21:55:19 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDXKNLEUTADRBN4MYXJAKGQER3GSBVA@isocpp.org Sat Jan 06 22:55:15 2018
Return-path: <std-proposals+bncBDXKNLEUTADRBN4MYXJAKGQER3GSBVA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f200.google.com ([209.85.217.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDXKNLEUTADRBN4MYXJAKGQER3GSBVA@isocpp.org>)
	id 1eXwQo-0004Ve-3x
	for gclcip-std-proposals@m.gmane.org; Sat, 06 Jan 2018 22:55:10 +0100
Original-Received: by mail-ua0-f200.google.com with SMTP id t24sf4458589ual.1
        for <gclcip-std-proposals@m.gmane.org>; Sat, 06 Jan 2018 13:57:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=OhXBszqwhsxgPCkOaY+1Bat2H2ilnnTWy6e+9kEKQzQ=;
        b=tjt2Bnqo204Qo0gg74JuR/6HgKkoFR6qYgy+2HdGCPu6A+Cuw6p9mCkrz9jGRtT1SW
         Q4hqXaYQlo0pjM3NreG7pJCcVUW+Rmg7ddvJgKUPJK+XfRU0H6lMW/TJaChe/w4uxVsO
         /7/yOE9gsLF4SxndEIivNNkbpDAuTcxUhC3gAtJ6/ky/t7QnWcJxNzQcsdcO2M2dwaRl
         bdVfH/+vQV3yTaMucx+pRkBSYxhB0Hgf6QM7m3Ai8xJP4oyXI13E9iTNekF5KR2TnVr1
         0T5Qsg2T0FSQ+SeWeh8wTZWogklle74yAmzmZrYIwLN5lZ4dn6Gr6TxB7vL6nYTiNVcg
         y5fg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=OhXBszqwhsxgPCkOaY+1Bat2H2ilnnTWy6e+9kEKQzQ=;
        b=lQQhiRyE9SpWiNxkioOry6WjF8V30t0cLJZ7KBJ7iX2lHnyV6gG5gjMBBi5MrxktuV
         tUlPwylL7V+ZazCHCS2YX0eMVp13JiQGDh29upiP0zh+HAHncXH5bfJvU60MroQnIDhI
         IU3CCId14WgLN148pOs8qBvxxYGusEmGqk26Cb9pb5OkNlS2s1T2LfBvNNAxKgvYZvB8
         D73+BLshdS1ARozqHayNfNTNsMuD99PQUBaQPbGdoGVHzZ6hwQw16mANjkdBzIXA9+LX
         VUg1R9qE2zQiQYyUwVVpDJWj0iJ8UtyDYAOsMLuLtnb+QhYEVVMtsxLsp8py+YvHX1h1
         VxTw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=OhXBszqwhsxgPCkOaY+1Bat2H2ilnnTWy6e+9kEKQzQ=;
        b=TA89Hh3S0w6Ky8RUc4Zlsuuqy0paRuj41cLapSLgrH8+k4wZZB34vg0EZHI1jZ1Ho6
         xRMfS29GTDejcbsddbmQlmSC43lsJCknGYNCtZbsjiYCRMbxsHlFnKJCuszfd1XQqhNn
         PzU3SfSAsGA55JIjuaKDS4dnhm71SLewqYCo2qg5uJlY7QOUdTdcv9GVyBP/A48RVeho
         gwDaGNihOlXV6NeZdoi1yhHCyiKMYphtZ5BqTMbifdctbHD1W4S/idLWL0CaPYwpnUQ3
         3GX4jySwqKszFzIUIC16WSiTM6w5NccCx+WNYv2pwLgrWJ+3a/9H9hK7iiB8rDi9tkeq
         Gw6w==
X-Gm-Message-State: AKwxytfo0kLKTQ4+OYRbDMHHMDKhLXoMsOYMU2UISudMEs8y60TSzY4C
	XzRBRUrnlWUqQ/VwzU0TbHGMWw==
X-Google-Smtp-Source: ACJfBotAdIOGaBSFWzLQraJN6MUuLJ36QaPt/kn5403NXJ42pUeNXPxq2wynXFtTay/+e2RsHjhgpw==
X-Received: by 10.31.226.135 with SMTP id z129mr3495827vkg.106.1515275833229;
        Sat, 06 Jan 2018 13:57:13 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.176.82.157 with SMTP id v29ls2000983uav.16.gmail; Sat, 06 Jan
 2018 13:57:11 -0800 (PST)
X-Received: by 10.31.174.73 with SMTP id x70mr723288vke.8.1515275831456;
        Sat, 06 Jan 2018 13:57:11 -0800 (PST)
In-Reply-To: <7A4EE214-FE5B-4EC2-BE9E-23522F55EE5B@gmail.com>
X-Original-Sender: blitzrakete@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:36523
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36523>

------=_Part_121_296914613.1515275830924
Content-Type: multipart/alternative; 
	boundary="----=_Part_122_549934375.1515275830924"

------=_Part_122_549934375.1515275830924
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable


>
> Do you have an example of how this would allow one to re-write code in a=
=20
> more maintainable way? I=E2=80=99m not familiar with Scala or the advanta=
ges that=20
> partial application can bring.
>

I imagine it is useful when you need to pass a function to an algorithm=20
which hasn't got the exact signature the algorithm needs. Basically, what=
=20
we would use std::bind or a lambda for currently:

    std::transform(Vec.begin(), Vec.end(), Vec.begin(), [](auto &&Var) {=20
return foo(10, Var); }); // now
    std::transform(Vec.begin(), Vec.end(), Vec.begin(), foo(10)); // after

It's a bit more maintainable just because it uses less characters I guess :=
)

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/d72691d1-58e5-474e-8b7d-07a29d73ddad%40isocpp.or=
g.

------=_Part_122_549934375.1515275830924
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"a=
uto"><div>Do you have an example of how this would allow one to re-write co=
de in a more maintainable way? I=E2=80=99m not familiar with Scala or the a=
dvantages that partial application can bring.<br></div></div></blockquote><=
div><br></div><div>I imagine it is useful when you need to pass a function =
to an algorithm which hasn&#39;t got the exact signature the algorithm need=
s. Basically, what we would use std::bind or a lambda for currently:</div><=
div><br></div><div>=C2=A0 =C2=A0 std::transform(Vec.begin(), Vec.end(), Vec=
..begin(), [](auto &amp;&amp;Var) { return foo(10, Var); }); // now</div><di=
v>=C2=A0 =C2=A0 std::transform(Vec.begin(), Vec.end(), Vec.begin(), foo(10)=
); // after</div><div><br></div><div>It&#39;s a bit more maintainable just =
because it uses less characters I guess :)</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d72691d1-58e5-474e-8b7d-07a29d73ddad%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d72691d1-58e5-474e-8b7d-07a29d73ddad=
%40isocpp.org</a>.<br />

------=_Part_122_549934375.1515275830924--

------=_Part_121_296914613.1515275830924--

.
