From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 8D4AE8239C for ; Wed, 14 Feb 2018 04:41:02 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=kennethadammiller@gmail.com; spf=Pass smtp.mailfrom=kennethadammiller@gmail.com; spf=None smtp.helo=postmaster@mail-wr0-f178.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of kennethadammiller@gmail.com) identity=pra; client-ip=209.85.128.178; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="kennethadammiller@gmail.com"; x-sender="kennethadammiller@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of kennethadammiller@gmail.com designates 209.85.128.178 as permitted sender) identity=mailfrom; client-ip=209.85.128.178; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="kennethadammiller@gmail.com"; x-sender="kennethadammiller@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-wr0-f178.google.com) identity=helo; client-ip=209.85.128.178; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="kennethadammiller@gmail.com"; x-sender="postmaster@mail-wr0-f178.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AxkGxCh1OPrk5i+ZusmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?seIQKPad9pjvdHbS+e9qxAeQG9mDsrQc06L/iOPJYSQ4+5GPsXQPItRndiQuro?= =?us-ascii?q?EopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZv?= =?us-ascii?q?JuTyB4Xek9m72/q99pHPfglEniaxba9vJxiqsAvdsdUbj5F/Iagr0BvJpXVIe+?= =?us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4fzLorFQI2xgPSo0C6+VrhXYmRLEBjYEnrucYiYW/4AYSeXI8tlnyYs?= =?us-ascii?q?Wr2oSotn3har4lypg4F7J/bZr3VL/ano08J4srGCzEBgxXlPF82Yllq1YSRxl2?= =?us-ascii?q?IMSSUx2fkm80N4w1aHl6N/hq4BTIAB17ZySg4/cKXk4aliEdmrA1DOe96ITBCt?= =?us-ascii?q?RdD0WWhsHOJ0+McHZgNGI/vnjh3H2HD0UboclrjOG4Zst6yFgCi3KMF6xHLLkq?= =?us-ascii?q?Imigt+Tw=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AcBQAur4NahrKAVdFdGwEBAQEDAQEBC?= =?us-ascii?q?QEBAYN5P3AoCoNbgTmXEYICgReBUIEahg2NSoIYCiOFGAKCYQcZBwQxFwECAQE?= =?us-ascii?q?BAQEBAQEBEgEBAQgLCwgoL4I4DIJgAQQBIwQZARsSCwEDAQsGBQQHGh0CAiIBE?= =?us-ascii?q?QEFAQoSBhMSigoBAw0IEKM2QIwXgW0YBQEcgwwFg2YKGScDCllZghMBAQEBAQE?= =?us-ascii?q?EAQEBAQEBAQEBFwIGEoRvghWGbYMkgiuCaoJlBYh1DIpikEsJiCCNZIMGkT6OA?= =?us-ascii?q?ooCFAUggRcPEgKCBTMaI1IyghQJghMqH4IwIzeOBgEBAQ?= X-IPAS-Result: =?us-ascii?q?A0AcBQAur4NahrKAVdFdGwEBAQEDAQEBCQEBAYN5P3AoCoN?= =?us-ascii?q?bgTmXEYICgReBUIEahg2NSoIYCiOFGAKCYQcZBwQxFwECAQEBAQEBAQEBEgEBA?= =?us-ascii?q?QgLCwgoL4I4DIJgAQQBIwQZARsSCwEDAQsGBQQHGh0CAiIBEQEFAQoSBhMSigo?= =?us-ascii?q?BAw0IEKM2QIwXgW0YBQEcgwwFg2YKGScDCllZghMBAQEBAQEEAQEBAQEBAQEBF?= =?us-ascii?q?wIGEoRvghWGbYMkgiuCaoJlBYh1DIpikEsJiCCNZIMGkT6OAooCFAUggRcPEgK?= =?us-ascii?q?CBTMaI1IyghQJghMqH4IwIzeOBgEBAQ?= X-IronPort-AV: E=Sophos;i="5.46,510,1511823600"; d="scan'208,217";a="254703908" Received: from mail-wr0-f178.google.com ([209.85.128.178]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 14 Feb 2018 04:41:01 +0100 Received: by mail-wr0-f178.google.com with SMTP id 34so10461921wre.13 for ; Tue, 13 Feb 2018 19:41:01 -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=8ZyIscfiVi7+lUocDnROVrvwzxoITAb73qbPY68jfto=; b=OhMVzSLN+iBmM9E8dJvyj1rvW1kVmYIrjxPMKlb7RwCZoGBCuCYyt5Y/5BVbS1B2e4 1LiD6yIBAPkniVvdiG35b9sQa7YovuL+VFYfPwtWeO30m3CmG9heg0AlzUkWyupt8wvV JEguVPYjyJQ5OEOI3VbhpLvUE1vKDAEZMAbqJDiEi+mRSGi4VS52s0DehO3GgwCzSIHA 92rzyIPQObV9JsoMxfLLNZSJoNGW0MfYM6LYb00a+MEYiAVCcNHcPbLHNAwIa+I8F6mQ zvgXYrdnETCL8En8jqTojeQSvshjuQu3+vuhNLh6D6T64+6b5lhtxNYB2xgOwpbAgM1s z2/A== 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=8ZyIscfiVi7+lUocDnROVrvwzxoITAb73qbPY68jfto=; b=YFv66aIrhNA0ZG2YYSddMhnB6ZfJ0oz/C63mRrgBZxa6MV2tOVbCE9lA8Tb3ZizgX4 gj7DJHKOc2g7d608DRWw8J/bFe0Y8smkPRfl7REkcCnChRTX3Pc+zvN01hm9Oxr7pqTF z6hz+V6GfcaqRygk6D5uU4ZleBt5W/I1kJTyGuzEy1df2IEMsclKw5eaumw2qdu+U1SD vLnhA9eqs/czmoHQrjtp54c0NRbjjDeoBG67V6kIebEZv8aupgbXJaubfhyiuaU/oclx VJMvFa/iq+sQzyryea7sadskEX9fuhKd3GKTdl4DJWUbMmlpuAsk0JiQpxOAjwv7J5zT UKDg== X-Gm-Message-State: APf1xPBUlzkqebI2Eo7uYlUlDtmTHqlnlDfoIlMoaMXqRmzM/mXqV+YP 6HgCXDzSnL1usLkXrJ9HGq5aVPIq+AKyQoBJQtYV9g== X-Google-Smtp-Source: AH8x224gUkmS4oxVOy3+YGcYsA4sziS0YCtaQFYDcifiQZYFe6Iq/gPV7sAsCd/6G3hew7rm5HxOGTD3VMsnVhtYKUU= X-Received: by 10.25.32.203 with SMTP id g194mr2261480lfg.101.1518579660928; Tue, 13 Feb 2018 19:41:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.114.6 with HTTP; Tue, 13 Feb 2018 19:41:00 -0800 (PST) In-Reply-To: <21BC6EDE-DB27-460B-A4D5-BBD583C9E899@TimLeonard.us> References: <21BC6EDE-DB27-460B-A4D5-BBD583C9E899@TimLeonard.us> From: Kenneth Adam Miller Date: Tue, 13 Feb 2018 22:41:00 -0500 Message-ID: To: Tim Leonard Cc: caml users Content-Type: multipart/alternative; boundary="001a1146d45640bd28056523e1e7" Subject: Re: [Caml-list] a question about syntax --001a1146d45640bd28056523e1e7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable No, it's keywords "in" that assigns the terminus to the current phrase so to speak. The first would look like this, if I understand you correctly: let f x =3D { field1 =3D match x with _ -> true | field2 =3D 2} in But there are several problems with the above statement. First, you used a semicolon in place of a |, and a | expresses to the match statement what the various cases are. As in, match x with | case1 ... | case 2 | ... Second, alternatively to that interpretation, you might want it to be that you match within the assignment like this: let f x =3D { field1 =3D (match x with ... ); field2 =3D ... } in A problem is that you used match x with _ -> true | field2, but the _ is the catchall keyword, so field2 is never going to get hit. What you've expressed in the second let statement is equivalent to this: let f1 =3D match x with _ -> true in let f x =3D { field1 =3D f1; field2.... } On Tue, Feb 13, 2018 at 10:31 PM, Tim Leonard wrote: > A simple question of syntax: why does the first definition of function f > cause a syntax error? > Shouldn=E2=80=99t the semicolon syntactically terminate the match express= ion? > > type my_record =3D { field1 : bool; field2 : int };; > > let f x =3D { field1 =3D match x with _ -> true ; field2 =3D 2 };; (* = this > fails *) > > let f x =3D { field1 =3D ( match x with _ -> true ); field2 =3D 2 };; (* = this is > ok *) > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs --001a1146d45640bd28056523e1e7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
No, it's keywords "in" that assigns the term= inus to the current phrase so to speak.

The first would look like th= is, if I understand you correctly:

let f x =3D { field1 = =3D match x with _ -> true | field2 =3D 2} in

But there ar= e several problems with the above statement. First, you used a semicolon in= place of a |, and a | expresses to the match statement what the various ca= ses are. As in,

match x with | case1 ... | case 2 = | ...=C2=A0

Second, alternatively to that interpretation, you might = want it to be that you match within the assignment like this:

let f = x =3D { field1 =3D (match x with ... ); field2 =3D ... } in

A proble= m is that you used match x with _ -> true | field2, but the _ is the cat= chall keyword, so field2 is never going to get hit. What you've express= ed in the second let statement is equivalent to this:

let f1 =3D mat= ch x with _ -> true in
let f x =3D { field1 =3D f1; field2....= }

On = Tue, Feb 13, 2018 at 10:31 PM, Tim Leonard <Tim@timleonard.us> wrote:
A simple question of syntax: wh= y does the first definition of function f cause a syntax error?
Shouldn=E2=80=99t the semicolon syntactically terminate the match expressio= n?

type my_record =3D { field1 : bool; field2 : int };;

let f x =3D { field1 =3D=C2=A0 =C2=A0match x with _ -> true=C2=A0 ; fiel= d2 =3D 2 };; (* this fails *)

let f x =3D { field1 =3D ( match x with _ -> true ); field2 =3D 2 };; (*= this is ok *)


--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--001a1146d45640bd28056523e1e7--