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 7FAD180211 for ; Thu, 19 Oct 2017 16:41:00 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=mail@matej-kosik.net; spf=SoftFail smtp.mailfrom=mail@matej-kosik.net; spf=SoftFail smtp.helo=postmaster@matej-kosik.net Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mail@matej-kosik.net) identity=pra; client-ip=145.239.83.105; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mail@matej-kosik.net"; x-sender="mail@matej-kosik.net"; x-conformance=sidf_compatible Received-SPF: SoftFail (mail2-smtp-roc.national.inria.fr: domain of mail@matej-kosik.net is inclined to not designate 145.239.83.105 as permitted sender) identity=mailfrom; client-ip=145.239.83.105; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mail@matej-kosik.net"; x-sender="mail@matej-kosik.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: SoftFail (mail2-smtp-roc.national.inria.fr: domain of postmaster@matej-kosik.net is inclined to not designate 145.239.83.105 as permitted sender) identity=helo; client-ip=145.239.83.105; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mail@matej-kosik.net"; x-sender="postmaster@matej-kosik.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" IronPort-PHdr: =?us-ascii?q?9a23=3A9YBTThL2aV8d3daipNmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgXLfTxwZ3uMQTl6Ol3ixeRBMOAtKIC1rKempujcFJDyK7JiGoFfp1IWk1Nou?= =?us-ascii?q?QttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBX/vHCo0j4TBhi6cCM9?= =?us-ascii?q?ZqGsQtaT3IyL0LW58pjXJgFJnyaVYLVoLRzwox+CmNMRhN5HI7o8yFPqpYnNeK?= =?us-ascii?q?wCwGppIXqWlgrx5IKz+4Vi8GJWtu53pJ0IarnzY6ltFe8QNz8hKW1goZSz7RQ?= =?us-ascii?q?=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DWBwA/uOhZZGlT75FdHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBgzRkA2sng3qLE5A/mEcHJoUYAoUJQxUBAQEBAQEBAQEBAQOBD4I?= =?us-ascii?q?4JAGCQQEFIwRiCQIYKgICVxMGAgEBiiAMjRydZ4FtOosiDBcKBYMvgluCZyuDA?= =?us-ascii?q?4RlAQFqgkiCYQWhU4Q/giGBAZh0hzOXLTUhgVyBBQpJgmSEYXSIMYI1AQEB?= X-IPAS-Result: =?us-ascii?q?A0DWBwA/uOhZZGlT75FdHAEBBAEBCgEBFwEBBAEBCgEBgzR?= =?us-ascii?q?kA2sng3qLE5A/mEcHJoUYAoUJQxUBAQEBAQEBAQEBAQOBD4I4JAGCQQEFIwRiC?= =?us-ascii?q?QIYKgICVxMGAgEBiiAMjRydZ4FtOosiDBcKBYMvgluCZyuDA4RlAQFqgkiCYQW?= =?us-ascii?q?hU4Q/giGBAZh0hzOXLTUhgVyBBQpJgmSEYXSIMYI1AQEB?= X-IronPort-AV: E=Sophos;i="5.43,402,1503352800"; d="asc'?scan'208";a="297024328" Received: from 105.ip-145-239-83.eu (HELO matej-kosik.net) ([145.239.83.105]) by mail2-smtp-roc.national.inria.fr with ESMTP; 19 Oct 2017 16:40:59 +0200 Received: from [192.168.1.10] (adsl-dyn234.78-99-243.t-com.sk [78.99.243.234]) by matej-kosik.net (Postfix) with ESMTPSA id 1D3AF1F59F for ; Thu, 19 Oct 2017 16:40:59 +0200 (CEST) To: caml-list@inria.fr References: <72565dd8-08e0-0fd3-a3df-6742e1957ec3@matej-kosik.net> From: =?UTF-8?B?TWF0ZWogS2/FocOtaw==?= Openpgp: id=1CD41D0A52319DC7ABC1B79F50AFFA128CE48649; url=http://matej-kosik.net/doc/kosik.asc Message-ID: Date: Thu, 19 Oct 2017 16:40:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fFtrTutN8EGPB46wuwCKFvoipfCChheHg" Subject: Re: [Caml-list] beginner question about pattern matching This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --fFtrTutN8EGPB46wuwCKFvoipfCChheHg Content-Type: multipart/mixed; boundary="pCjvg7rbr1S24Rg3wqlGMrsqJu6vVTwdx"; protected-headers="v1" From: =?UTF-8?B?TWF0ZWogS2/FocOtaw==?= To: caml-list@inria.fr Message-ID: Subject: Re: [Caml-list] beginner question about pattern matching References: <72565dd8-08e0-0fd3-a3df-6742e1957ec3@matej-kosik.net> In-Reply-To: --pCjvg7rbr1S24Rg3wqlGMrsqJu6vVTwdx Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Ok. Thank you all. I suspected as much but I wanted to check with someone e= lse. (Adding a note about n+1-st note about Ocaml quirks and moving on.) (* NOTE: This looks bad, but Ocaml (4.06 beta) does not allow me to do = any better *) | [Rtag (f1,f2,f3,f4)] -> f1,f2,f3,f4 On 10/19/2017 04:34 PM, Gabriel Scherer wrote: > This is a small hiccup with the OCaml (non-revised) syntax: >=20 > | Foo of bar * baz * blah >=20 > and >=20 > | Foo of (bar * baz * blah) >=20 > are not equivalent, and only the latter allows to do what you want. >=20 >=20 > On Thu, Oct 19, 2017 at 3:38 PM, Matej Ko=C5=A1=C3=ADk wrote: >> Hi, >> >> I am trying to do simple pattern matching of these values: >> https://github.com/ocaml/ocaml/blob/trunk/parsing/parsetree.mli#L145 >> >> What I would like to do is: >> >> | [Rtag the_whole_4_tuple] -> >> the_whole_4_tuple >> >> However, when I try to do that, I am getting: >> >> Error: The constructor Rtag expects 4 argument(s), >> but is applied here to 1 argument(s) >> >> This: >> >> | [Rtag (f1,f2,f3,f4)] -> >> f1,f2,f3,f4 >> >> of course works but (regardless of the chosen bound variable names), it = looks amateurish. >> >> What's the right way to do this? >> (I would like just to bind a 4-tuple and then return it) >> >> (Apologies in advance for a stupid question.) >> >=20 --pCjvg7rbr1S24Rg3wqlGMrsqJu6vVTwdx-- --fFtrTutN8EGPB46wuwCKFvoipfCChheHg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEHNQdClIxncerwbefUK/6EozkhkkFAlnouXkACgkQUK/6Eozk hklOPxAAoUrZheHglQzsuLBfxbbJTNF31wLG+7Vlp8a4AxS5gLMUEg/MMa6xenug qp+v2Lj45/XkrtBXEPeZK+URSukL4vfgNh2QYniShLY2VjggBk7FGzgCLZvDK6M/ iWDSdRxGftfjJbLLllbccaKu47aoEjL/IXv7c/r3D4WEARi29zhUeXg6OpHBydsR /pKNb2X/kFakKzbZAnUyW5Pc0ICJV4EZCl4YOwxFXzdTl280JZNxO5M0YNxsZeyz rUZmwYWObhgDxXBlLSk2Hl6Rb5r9kOu7tgrUTIBoB1Q0yBUMEjOygN082WpJuZlu p4nTTAChxlnvJicJuoXPChRB8W93pRBrIrXzXS0E4hTW65p0aA+V60zrhbISdBfh YNQSs2w9YDVOP1QryoGisvoNSwG6mi5F571ylvQ5ikooyBBSHFYYDlqee98uqjn6 0GGLdcEuE3kb+TFx2lN6eKmTNa4hNKgWyYXxphmZcDSoaAI6QQu3pPV6krycMdak +utamoriyd5m0KWvdwWJY7qJD9ap9zDCkrSdFr2qXBu1qpTfFIYS4khDtLU/ynrM MHMnDEukymm/4h19YUh06eukIw02m4RvDwzHDSYb63ka5yWvcP2D8dyqJR8eryYp haxaXs+2NQqgAqismCb8YbZ/1LZRvdStf6+HXKRTm5xjnSiQKSc= =/oao -----END PGP SIGNATURE----- --fFtrTutN8EGPB46wuwCKFvoipfCChheHg--