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 EB4FC7EE51 for ; Sat, 27 Apr 2013 10:05:23 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.220.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.220.176 as permitted sender) identity=mailfrom; client-ip=209.85.220.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-vc0-f176.google.com) identity=helo; client-ip=209.85.220.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-vc0-f176.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApICAIOFe1HRVdywlWdsb2JhbABRgz2sK5IZeAgWDgEBAQEHDQkJEiqCHwEBBScZARsSCwEDDAYFCw0NISIBEQEFAQoSGRKHbwEDDwyiFIwxgn2ERAoZJwMKWYdeAQUMjwYHFoM4A5cdgSWOHxYphDY6 X-IPAS-Result: ApICAIOFe1HRVdywlWdsb2JhbABRgz2sK5IZeAgWDgEBAQEHDQkJEiqCHwEBBScZARsSCwEDDAYFCw0NISIBEQEFAQoSGRKHbwEDDwyiFIwxgn2ERAoZJwMKWYdeAQUMjwYHFoM4A5cdgSWOHxYphDY6 X-IronPort-AV: E=Sophos;i="4.87,562,1363129200"; d="scan'208";a="15103549" Received: from mail-vc0-f176.google.com ([209.85.220.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 27 Apr 2013 10:05:23 +0200 Received: by mail-vc0-f176.google.com with SMTP id ib11so202979vcb.7 for ; Sat, 27 Apr 2013 01:05:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=CMYV2l6O3vsoH2sMyeIvbXof8nCzOLuDEV/WiX2y4ek=; b=ErVClwcsKE2aoQFWyc4e2EYBLDC7jwrde9/3d75x7/6uwf7OFywVjrW5kb0VbdCbw1 n+jjzVwqWgsyYWo0anzE3SCRJPHA1Yzg87HSMcVutWEhTDPXkmBVyS3Cf2os41P61cgP fSSSmDKOVoB2ISXI2XInc1y3Ioe1lMvbqFp2nLrMZEhsGPtDjdZ8G58Zyf0BtuIiWZhI 1Vc51qpSeseYJOqf9Spx74UqMewIGLbi8cW8rKLeso462E22X9w1Tv09rk42lNcGkubP Zg3Wa9gn4yhvtEo0Q68ewait+bUCUKAUCpVcUgI455GAyvRxDR1hJ2J7MQlz7MiGtKaV HZcA== X-Received: by 10.52.114.135 with SMTP id jg7mr25745658vdb.78.1367049922620; Sat, 27 Apr 2013 01:05:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.152.38 with HTTP; Sat, 27 Apr 2013 01:04:42 -0700 (PDT) In-Reply-To: <20130427071838.GA29737@ombreroze.happyleptic.org> References: <20130427071838.GA29737@ombreroze.happyleptic.org> From: Gabriel Scherer Date: Sat, 27 Apr 2013 10:04:42 +0200 Message-ID: To: rixed@happyleptic.org Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] syntax suggestion This is a subset of Richard Jones' "matches" syntax extension, turning an pattern matching on 'a into a ('a -> bool) function: if (matches Some x when x > 15) variable then ... (The original extension did not handle "when", but it would be quite easy to add.) On Sat, Apr 27, 2013 at 9:18 AM, wrote: > Wouldnt it be nice if, as a special form of the = operator, > "variable = pattern when condition" were equivalent to > "match variable with pattern when condition -> true | _ -> false" ? > > So that one could easily check optional values for instance: > > if variable = Some x when x > 15 then blabla > > What do you think? > > > -- > 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