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 A7DE08239C for ; Wed, 14 Feb 2018 05:12:42 +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-io0-f180.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.223.180; 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.223.180 as permitted sender) identity=mailfrom; client-ip=209.85.223.180; 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-io0-f180.google.com) identity=helo; client-ip=209.85.223.180; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yawar.amin@gmail.com"; x-sender="postmaster@mail-io0-f180.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AgO3S4x83d+DKLP9uRHKM819IXTAuvvDOBiVQ1KB4?= =?us-ascii?q?1+IcTK2v8tzYMVDF4r011RmVBdyds6oMotGVmpioYXYH75eFvSJKW713fDhBt/?= =?us-ascii?q?8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1?= =?us-ascii?q?Ifn+FpLPg8it2O2+54Dfbx9UiDahfLh/MAi4oQL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uDZ?= =?us-ascii?q?J53SkyDcedNamGXpqk2eXT0yKyH5kQbWdDWAjVTCXYMr6cUvJJUxq8Z89sljte?= =?us-ascii?q?C+qkQo4lkBCp7Er0kuo/aOXT/SIcuNTo090nv+A=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0D9BgAytoNaf7TfVdFcHAEBAQQBAQoBA?= =?us-ascii?q?YUoKAqDW4E5lxGDGYJqhg2PYgqFOwKCYQcZBwQ0FAECAQEBAQEBAQEBEgEBCQs?= =?us-ascii?q?LCCYxgjgkAYJHBiMEGQEbHQEDDAYFBAEGNwICIgERAQUBHAYTihwBAxWjTUCMF?= =?us-ascii?q?4FtGAUBHIMMBYNmChknDVlZghMBAQEBAQUBAQEBAQEBGQIGEoRvghWBV4UWiDm?= =?us-ascii?q?CZQWTY5BLCYJMkziURJgEFAUggRc2R4ErMxojUjKCFIJGgk8jN44GAQEB?= X-IPAS-Result: =?us-ascii?q?A0D9BgAytoNaf7TfVdFcHAEBAQQBAQoBAYUoKAqDW4E5lxG?= =?us-ascii?q?DGYJqhg2PYgqFOwKCYQcZBwQ0FAECAQEBAQEBAQEBEgEBCQsLCCYxgjgkAYJHB?= =?us-ascii?q?iMEGQEbHQEDDAYFBAEGNwICIgERAQUBHAYTihwBAxWjTUCMF4FtGAUBHIMMBYN?= =?us-ascii?q?mChknDVlZghMBAQEBAQUBAQEBAQEBGQIGEoRvghWBV4UWiDmCZQWTY5BLCYJMk?= =?us-ascii?q?ziURJgEFAUggRc2R4ErMxojUjKCFIJGgk8jN44GAQEB?= X-IronPort-AV: E=Sophos;i="5.46,510,1511823600"; d="scan'208,217";a="254704907" Received: from mail-io0-f180.google.com ([209.85.223.180]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 14 Feb 2018 05:12:41 +0100 Received: by mail-io0-f180.google.com with SMTP id t22so3783748iob.3 for ; Tue, 13 Feb 2018 20:12:41 -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=7e9JpFTarAYZIr715hY7ubCttasdl6rtd+f18LjdHAk=; b=ZR9kku+MhkwjivxzrdDYyEysD8DJhh5V10f+gJbIshjMh8LUgEKQYQe8E21Wt7zbIF +s/0VI3UgWBqQOI6M+wQo3lW/pHBnyoTYDxGMHWqpO7QyhRkiR2hpclptXC1Ysox/2Un aqF20yK6DcjhbFRUiCIZFNvti1IqpRi3eNGDyglDq57YAgd40ofPZEkSuYcMKVugxf/Z PIA2CPSlFnLd3Vm3NkI/u+yeSAYpX7QOOrkHpAJUZlbgoIeu6jVbhaRxU2QUXhLlVLLa NRe3LfSTWPsivMHCJhZzGSK7PU45aV0kZVaV5iUnI613IPPW2FgVsLaadnVfvsDK+yy2 FZFw== 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=7e9JpFTarAYZIr715hY7ubCttasdl6rtd+f18LjdHAk=; b=tc70hU9IFj9LFqXAXfVN7a0Lt6wywd92vfKpy+yTbnbDX2tVTJ0SGmm/OPrfR4rPVY 8OBiWMU8Pyh3/yNyZJc5pHvL1UXuv0ypZOdx5Ea3g7C7xfLpB5PgzkdGoZXHnyIVb4Ez Y6cCrU/z/VySkZd+waMkPM8KcMUSsW9oAt/ZxZjnPc51sPow0T/5gv3Xvhy6KHW7LPri it1WWuhzPxvv1my7CzY59XKvtjZxbXOriPqPsfDhDRQ6c8HULErSAtY39fYTgqfAAut1 kzhSNTD4ZUBh2GDESjBMDDiil/8G/7LWcbGIrK80uHGHyMpwEY8U7FqkDRmQEUidNb0l F23Q== X-Gm-Message-State: APf1xPC7053vmo21BDTYp7HDoUa7qBl6ilSp3+40BOkxgoik2HaN+r1t Ohm2Dyi86yntj6tAie8UqFSmSunhi7/FQr55Zg== X-Google-Smtp-Source: AH8x227sjmgtPQjp73oDANCTktq3eo9Kibcog8lImn76jU2GC5jVnf8HKQqVuPLLac+cfNflrjRYHRF3FSkao3p0bcs= X-Received: by 10.107.134.95 with SMTP id i92mr163194iod.210.1518581559583; Tue, 13 Feb 2018 20:12:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.79.67 with HTTP; Tue, 13 Feb 2018 20:12:19 -0800 (PST) In-Reply-To: <21BC6EDE-DB27-460B-A4D5-BBD583C9E899@TimLeonard.us> References: <21BC6EDE-DB27-460B-A4D5-BBD583C9E899@TimLeonard.us> From: Yawar Amin Date: Tue, 13 Feb 2018 23:12:19 -0500 Message-ID: To: Tim Leonard Cc: Ocaml Mailing List Content-Type: multipart/alternative; boundary="001a113ec9126bea1f0565245231" Subject: Re: [Caml-list] a question about syntax --001a113ec9126bea1f0565245231 Content-Type: text/plain; charset="UTF-8" Hi, On Tue, Feb 13, 2018 at 10:31 PM, Tim Leonard wrote: > [...] > type my_record = { field1 : bool; field2 : int };; > > let f x = { field1 = match x with _ -> true ; field2 = 2 };; (* this > fails *) > This fails because OCaml overloads ';' in a few different ways, significantly: (1) as a field separator in a record, and (2) as a sequencing operator between two expressions. In case of ambiguity OCaml parses as the latter, but you really meant the former. (2) 'sequencing operator' means that something like: let x = print_endline "Hi!"; 1 ... will evaluate whatever is on the left of the ';', throw away its value (in this case 'unit'), then evaluate whatever is on the right of the ';' and return *its* value as the final value of the compound expression. Regards, Yawar --001a113ec9126bea1f0565245231 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

On Tue, Feb 13, 2018 at 10:31 PM, Tim Leonard <Tim@timleonard.= us> wrote:
[...]
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 *)

This fail= s because OCaml overloads ';' in a few different ways, significantl= y: (1) as a field separator in a record, and (2) as a sequencing operator b= etween two expressions. In case of ambiguity OCaml parses as the latter, bu= t you really meant the former.

(2) 'sequencing operat= or' means that something like:

let x =3D print_endline "Hi!"; 1=

... will evaluate whatever is on the left of the ';&= #39;, throw away its value (in this case 'unit'), then evaluate wha= tever is on the right of the ';' and return its value as the= final value of the compound expression.

Regards,

=
Yawar
--001a113ec9126bea1f0565245231--