From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 8B1C982355 for ; Wed, 13 Dec 2017 18:52:04 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=yawar.amin@gmail.com; spf=Pass smtp.mailfrom=yawar.amin@gmail.com; spf=None smtp.helo=postmaster@mail-it0-f45.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of yawar.amin@gmail.com) identity=pra; client-ip=209.85.214.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yawar.amin@gmail.com"; x-sender="yawar.amin@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of yawar.amin@gmail.com designates 209.85.214.45 as permitted sender) identity=mailfrom; client-ip=209.85.214.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yawar.amin@gmail.com"; x-sender="yawar.amin@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-it0-f45.google.com) identity=helo; client-ip=209.85.214.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yawar.amin@gmail.com"; x-sender="postmaster@mail-it0-f45.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3A4tR8VhL8I4j/0HtjLdmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgRKvTxwZ3uMQTl6Ol3ixeRBMOHs6sC07KempujcFRI2YyGvnEGfc4EfD4+ou?= =?us-ascii?q?JSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgpp?= =?us-ascii?q?POT1HZPZg9iq2+yo9JDffxhEiCChbb9uMR67sRjfus4KjIV4N60/0AHJonxGe+?= =?us-ascii?q?RXwWNnO1eelAvi68mz4ZBu7T1et+ou+MBcX6r6eb84TaFDAzQ9L281/szrugLd?= =?us-ascii?q?QgaJ+3ART38ZkhtMAwjC8RH6QpL8uTb0u+ZhxCWXO9D9QLYpUjqg8qhrUgflhy?= =?us-ascii?q?UJNzA5/m/ZidF+grxHrx+6vRNz35TZbZuJOPZifK7Qe84RS2pbXsZWUixMGoGz?= =?us-ascii?q?YJEBDuUbJ+ZTspXwp14PrRu4GAKhA+PuxSVGh3Dsx602yf4uEQTH3AwmBN8Ov3?= =?us-ascii?q?HUo8/0NKcWS+y60K7IzTDaYv5QxDzz65DIfwg/rf2QWb98a8ncxEk1Gw/bk1md?= =?us-ascii?q?ppbpMjyV2+kLrmOV9fBvVfi1hG4iswxxoiagxsMrioTRg4Ia0FHE9SFgzIY0Od?= =?us-ascii?q?20VFd3YdCrHZZQrS2aOIx2QsQtQ2Fspik20KEJuZm+fCQSyZQnwQDQa+CffoSW?= =?us-ascii?q?/h7uUPydLDR4iX5/Zr6zmhm//VKvx+D8TsW01UxFritBktnCrHAN0BnT59CHS/?= =?us-ascii?q?Rn8EauwyyP2xrJ5eFBIEA0k7HWK5EkwrEql5oTtV7PETPxmEXzlKOWbFkr+vC0?= =?us-ascii?q?6+T7ZbXrvoOTOJVxigH6K6guns2/Af8kMgUVRGia+eG81KX58kHjQbVKiOc2kq?= =?us-ascii?q?jDv5zAK8QbvP3xPwgA/o896hr3JjOiy9MAhTFTIEhMPRSKkJPBPlzSKevkBPy8?= =?us-ascii?q?xV+rlWE46erBO+jQC4rENDDqlbbnNeJs4lFV0kw6yNFZz51RA7AFZvn0Xxmi55?= =?us-ascii?q?TjEhYlPlnskK7cA9Jn29ZGVA=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AIBADLZzFahi3WVdFdHAEBAQQBAQoBA?= =?us-ascii?q?YRjNScHg3uBNpdwgX2JbIdYhU2CFQoYAYUiAoUMB0AXAQEBAQEBAQEBARIBAQE?= =?us-ascii?q?ICwsIKC+COCKCSQEBAQECAQEiBBkBGxEMAQMBCwYFBAcDCicDAgIiAREBBQELE?= =?us-ascii?q?QYTGol1AQMNCJwdQIwQgW0YBQEcgwsFg14KGScNWYI/AQEBAQEBBAEBAQEBARo?= =?us-ascii?q?CBhKDToILgVaFFIMvhQOCYwWTKI93gjmSbpNollIUBR+BFyABggUyGiNPMoF3g?= =?us-ascii?q?kMfghEjN4o6AQEB?= X-IPAS-Result: =?us-ascii?q?A0AIBADLZzFahi3WVdFdHAEBAQQBAQoBAYRjNScHg3uBNpd?= =?us-ascii?q?wgX2JbIdYhU2CFQoYAYUiAoUMB0AXAQEBAQEBAQEBARIBAQEICwsIKC+COCKCS?= =?us-ascii?q?QEBAQECAQEiBBkBGxEMAQMBCwYFBAcDCicDAgIiAREBBQELEQYTGol1AQMNCJw?= =?us-ascii?q?dQIwQgW0YBQEcgwsFg14KGScNWYI/AQEBAQEBBAEBAQEBARoCBhKDToILgVaFF?= =?us-ascii?q?IMvhQOCYwWTKI93gjmSbpNollIUBR+BFyABggUyGiNPMoF3gkMfghEjN4o6AQE?= =?us-ascii?q?B?= X-IronPort-AV: E=Sophos;i="5.45,397,1508796000"; d="scan'208,217";a="248264927" Received: from mail-it0-f45.google.com ([209.85.214.45]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 13 Dec 2017 18:52:02 +0100 Received: by mail-it0-f45.google.com with SMTP id f143so4783565itb.0 for ; Wed, 13 Dec 2017 09:52:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KOJ57NhTkS0vYTygxAkU8WgBqVpK+0nXUVuj+MCFXSo=; b=o3ur6wD90AzdyAR/fMJ3hVZFpbm6Kn/K2eTmp0Jo1HkdseRFJ6X+A8y/jauD0g/tQi 6dSPs03yWO+uwOVIc58GKCKvXO+BqOvlvdjTEz5nYHXsvF8rtQjVlla7ShWs1ytkbWVi 3jf7kr7NSy90fsNA0me1YiWEWxeXNE9JstN8Vl7TiIYXVWFI8iI67Vx5PmZaiS5X58Vh 4EvOTYA/Svn2dlhvgTbyA9sSBjoWcQ4cvJv7wlR6Er01T4Oumx2eFmbs0v+fgibvGlZd nT8YLdbW/T0M+G7Pil9ckxSOzuGtJZnlbxE4Ooym56ykn2mb2XYc2CuzykWizoZV4xe7 8zmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KOJ57NhTkS0vYTygxAkU8WgBqVpK+0nXUVuj+MCFXSo=; b=VSeFzkmd7su/L9Z1RnsSes0hxB6G1Ls58XDPWC145CHsUg9UN6FCm9EWueZdNexZCG H4xU+ff8MTWG70EM1SvC8uk1iovKjGglHAGbrzhwHeMxJAT/96Gj8aczhflWW/kyhBmu 46bwXf6FUQj3Fe/u1hWJDPBAmGnkl62cjhXBDcOt+rVuFhVoVO6j2Mtr9D5VamjsJsYC 5S3j8ftluCB34pahc6xiUNCVXTGjkL8NjS+/1bpzPWztNcexCAQhf9HDbqmsv+zfD2En 4XnWG1qsF0tIvaqGv/EJ9lg1Icum5IvghCW7CIPLLdyzGZu7kopge6zUvzcJvgi3x413 QtZg== X-Gm-Message-State: AKGB3mJoDRwEF+qEl0s+xjjpo10oURmJ1eL4a6iL9UKpQtpu20BOXPAm Fw41ppbSbPv4nkbQNxWLStKmEY+/NkRuKIdxyjUA X-Google-Smtp-Source: ACJfBospXrJwTyHiE7HPh7y/NSS9CzuOrb0o56LFyhtb81+xkViBSCZC6GTxjtBpZ2jYz9ArHppDjAj5JCtELtc9Yks= X-Received: by 10.107.97.16 with SMTP id v16mr3725321iob.263.1513187520885; Wed, 13 Dec 2017 09:52:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.181.19 with HTTP; Wed, 13 Dec 2017 09:51:40 -0800 (PST) In-Reply-To: References: <6640cb32-fec3-e048-3f40-53d65bae5305@gerd-stolpmann.de> <20171211161024.kafvtxzq3qcoo46p@matica.foolinux.mooo.com> <131064f1-4d53-5fbc-8aa7-0f6210dcb7bd@irisa.fr> <20171213122648.298e7edd@zinid.ru> <7BE82AAB-9F65-49E4-B9A8-69FCC5719253@logical.net> From: Yawar Amin Date: Wed, 13 Dec 2017 12:51:40 -0500 Message-ID: To: David Allsopp Cc: Marshall , "caml-list@inria.fr" Content-Type: multipart/alternative; boundary="089e0825a658a93c8c05603c6caa" Subject: Re: [Caml-list] ReasonML concrete syntax --089e0825a658a93c8c05603c6caa Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi David, ah yes, you're right of course. Interestingly, the Reason formatting tool reformats both of these into: let g1 =3D (x) =3D> { print_int(x); print_int }; let g2 =3D (x) =3D> { print_int(x); (y) =3D> print_int(y) }; I think it makes it very easy to tell that the latter just includes a redundant eta abstraction and can be simplified to the former. Regards, Yawar On Wed, Dec 13, 2017 at 12:20 PM, David Allsopp wrote: > Yawar Amin wrote: > > On Wed, Dec 13, 2017 at 11:38 AM, Marshall > wrote: > > > On Dec 13, 2017, at 4:37 AM, David Allsopp dra-news@metastack.com> wrote: > > > > > > > In terms of why you might want to be "hiding" currying, or at least > making it need > > > > less immediate explanation when learning the language, consider, for > example, > > > > explaining the difference between: > > > > > > > > let f x y =3D print_int x; print_int y in > > > > f 42 > > > > > > > > and > > > > > > > > let g x =3D print_int x; print_int in > > > > g 42 > > (code amended to give the functions different names) > > > > Apart from ReasonML, this is interesting. Why do these behave > differently? > > > I don=E2=80=99t understand yet. > > > > In the second example, the second `print_int` never gets called. > > No, both functions have the same type (int -> int -> unit) and if they're > applied to two integers then each will print both of them to stdout. The > difference is when they're partially applied - [f] prints nothing; [g] > prints 42. It's slightly less unclear in lambda form: > > let f =3D > fun x -> > fun y -> > print_int x; > print_int y > > let g =3D > fun x -> > print_int x; > fun y -> > print_int y > > > David > > --089e0825a658a93c8c05603c6caa Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi David, ah yes, you're right of course. Interestingl= y, the Reason formatting tool reformats both of these into:

<= div>
let g1 =3D (x) =3D> {
=C2=A0 print_int(x);
= =C2=A0 print_int
};

let g2 =3D (x) =3D&g= t; {
=C2=A0 print_int(x);
=C2=A0 (y) =3D> print_int(= y)
};

I think it makes it very eas= y to tell that the latter just includes a redundant=C2=A0eta abstraction an= d can be simplified=C2=A0to the former.

Regards,

Yawar


On Wed, Dec 13, 2017 at 12:20 PM, Da= vid Allsopp <dra-news@metastack.com> wrote:
Yawar Amin wrote:
> On Wed, Dec 13, 2017 at 11:38 AM, Marshall <mailto:marshall@logical.net> wrote:
> > On Dec 13, 2017, at 4:37 AM, David Allsopp <m= ailto:dra-news@metastack.com<= wbr>> wrote:
> >
> > > In terms of why you might want to be "hiding" curr= ying, or at least making it need
> > > less immediate explanation when learning the language, consi= der, for example,
> > > explaining the difference between:
> > >
> > > let f x y =3D print_int x; print_int y in
> > > f 42
> > >
> > > and
> > >
> > > let g x =3D print_int x; print_int in
> > > g 42

(code amended to give the functions different names)

> > Apart from ReasonML, this is interesting.=C2=A0 Why do these beha= ve differently?
> > I don=E2=80=99t understand yet.
>
> In the second example, the second `print_int` = never gets called.

No, both functions have the same type (int -> int -> unit) and= if they're applied to two integers then each will print both of them t= o stdout. The difference is when they're partially applied - [f] prints= nothing; [g] prints 42. It's slightly less unclear in lambda form:

let f =3D
=C2=A0 fun x ->
=C2=A0 =C2=A0 fun y ->
=C2=A0 =C2=A0 =C2=A0 print_int x;
=C2=A0 =C2=A0 =C2=A0 print_int y

let g =3D
=C2=A0 fun x ->
=C2=A0 =C2=A0 print_int x;
=C2=A0 =C2=A0 fun y ->
=C2=A0 =C2=A0 =C2=A0 print_int y


David


--089e0825a658a93c8c05603c6caa--