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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 05A078239C for ; Wed, 14 Feb 2018 19:50:51 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=oliver@first.in-berlin.de; spf=None smtp.mailfrom=oliver@first.in-berlin.de; spf=None smtp.helo=postmaster@einhorn-mail.in-berlin.de Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of oliver@first.in-berlin.de) identity=pra; client-ip=192.109.42.8; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="oliver@first.in-berlin.de"; x-sender="oliver@first.in-berlin.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of oliver@first.in-berlin.de) identity=mailfrom; client-ip=192.109.42.8; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="oliver@first.in-berlin.de"; x-sender="oliver@first.in-berlin.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@einhorn-mail.in-berlin.de) identity=helo; client-ip=192.109.42.8; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="oliver@first.in-berlin.de"; x-sender="postmaster@einhorn-mail.in-berlin.de"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3A21BJkh+l0pbFl/9uRHKM819IXTAuvvDOBiVQ1KB4?= =?us-ascii?q?1+IcTK2v8tzYMVDF4r011RmVBd6ds6oMotGVmpioYXYH75eFvSJKW713fDhBt/?= =?us-ascii?q?8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1?= =?us-ascii?q?Ifn+FpLPg8it2O2+55Pebx9UiDahfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+?= =?us-ascii?q?RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTF?= =?us-ascii?q?UACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMMvrRr42RDui9b9mRh/2hi?= =?us-ascii?q?kaNTE2/n3YhcNtg6xUux+hux9yz5LIbI2JLvdzfKXQds4aS2pbWcZRUjRMDJq4?= =?us-ascii?q?b4sOEeoOI/xYpJTgqlQUqxuxGBejBOfywTJPgX/22aw60/o/HgHcxwEgEdMOsG?= =?us-ascii?q?7PrNXpLqsSUOa1wLDTwjrddfNW3Tb96I7Sfh88v/6BRLR9etfSx0k3Dw7Jk1Gd?= =?us-ascii?q?pZL/Mz+IyugAt3KX4uV+We61iGMrswN8rzu1ysosioTFnJ8Zx1LF+Cljzos4I8?= =?us-ascii?q?CzRlRhbt6+CpRQsjmXN4toTcMmRGFloDg1yrwAuZ67eygK0pInywfaa/OdcoiI?= =?us-ascii?q?5gjvVOeXITthn31qZqi/hxKz8Uim0OHzS9e73E5LripDjNbMqmgA2wHX58SZUP?= =?us-ascii?q?dx41ut1DKV2w3c9O1IO0M5mbLeK5E7w74wkpQTsV7EHi/zgEj2i6uWdkQ6+ue2?= =?us-ascii?q?8eTqebvmpp6GN49vlgHyKKUumsqmDesjLAcORWyb+eW61LH54EL2Xq1Gjucqna?= =?us-ascii?q?nBrJDaOcMbq7alDABP14Yj7w+zDzOn0NQDgXkKN0lFeRKCj4jxIV7COvH4DfGl?= =?us-ascii?q?g1Stijhn3f7GPqeySqnKe3PKlbOkebdm92ZdzhAyxJZR/cF6ELYEddX3W1H8rp?= =?us-ascii?q?TyBxk1Pgj8l+HjCctwzKsQWHiUHumYNubYvEWM5+RpL+TaN9xdgyr0N/Vwv62m?= =?us-ascii?q?tnQ+g1JIJfD4j6tSU2ixG7FdG2vcZHPthtkbFmJQ5lgwTfbxlBuDV3tZamy2Xq?= =?us-ascii?q?R66jxpUNv6X7eGfZikhfm65An+BodfPDgUBFGWCmuudoPBUfoWbCOUZMNswGRd?= =?us-ascii?q?COqRDrQ53BTrjzfUjrpqKu2OpX8VtJTj08JzoujalBV09DoxBcmH12CLCW15zD?= =?us-ascii?q?sF?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DrAQDFhIRahwgqbcBdHgEYBoUcKINli?= =?us-ascii?q?xiPEoEXmFoKhTsCgxYGBTQUAQIBAQEBAQEBAQESAQEBCgsJCCgvQg4BgWcigko?= =?us-ascii?q?BBAEjBAsBBUYWGgIYDgJZGYotCASvZoFtOokAgkWBD4NziQKFboJLgmUFpC8Jg?= =?us-ascii?q?SGUVyNiiz+IDpdsAgQCBAUCGQEGgTY2gXIzGggcFD2CRoJlghN3gT6MRAEBAQ?= X-IPAS-Result: =?us-ascii?q?A0DrAQDFhIRahwgqbcBdHgEYBoUcKINlixiPEoEXmFoKhTs?= =?us-ascii?q?CgxYGBTQUAQIBAQEBAQEBAQESAQEBCgsJCCgvQg4BgWcigkoBBAEjBAsBBUYWG?= =?us-ascii?q?gIYDgJZGYotCASvZoFtOokAgkWBD4NziQKFboJLgmUFpC8JgSGUVyNiiz+IDpd?= =?us-ascii?q?sAgQCBAUCGQEGgTY2gXIzGggcFD2CRoJlghN3gT6MRAEBAQ?= X-IronPort-AV: E=Sophos;i="5.46,513,1511823600"; d="scan'208";a="313610008" Received: from einhorn.in-berlin.de (HELO einhorn-mail.in-berlin.de) ([192.109.42.8]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2018 19:50:47 +0100 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from localhost (yak.in-berlin.de [192.109.42.109]) by einhorn.in-berlin.de (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id w1EIokcm017185 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 14 Feb 2018 19:50:46 +0100 Received: from x4e37b003.dyn.telefonica.de (x4e37b003.dyn.telefonica.de [78.55.176.3]) by webmail.in-berlin.de (Horde Framework) with HTTPS; Wed, 14 Feb 2018 19:50:46 +0100 Date: Wed, 14 Feb 2018 19:50:46 +0100 Message-ID: <20180214195046.Horde.mSIwdxq5Yo9xUKgfzIss4Ey@webmail.in-berlin.de> From: Oliver Bandel To: caml-list@inria.fr In-Reply-To: <21BC6EDE-DB27-460B-A4D5-BBD583C9E899@TimLeonard.us> User-Agent: Horde Application Framework 5 Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] a question about syntax Zitat von Tim Leonard (Tue, 13 Feb 2018 22:31:14 -0500) > A simple question of syntax: why does the first definition of > function f cause a syntax error? > Shouldn’t the semicolon syntactically terminate the match expression? No. You can use semicolon to put more then one expression together. So the "field2 = 2" is seen as part of the match. If you have a pattern matching, this way you can put multiple commands/expressions in a row, without the need to use begin/end or ( ) in any match-case. It's the other way around: you need to put begin/end or ( ) around a match-statement. This way you have to add one such enclosing around a match-statement, instead of one such enclosing in any match-case of such a statement. > > type my_record = { field1 : bool; field2 : int };; > > let f x = { field1 = match x with _ -> true ; field2 = 2 };; (* > this fails *) Here I get "Error: Unbound value field2", which is, because the match-case reaches until the }. > > let f x = { field1 = ( match x with _ -> true ); field2 = 2 };; (* > this is ok *) Here it works, because the match-statement is sorrounded / enclosed by ( and ). Ciao, Oliver