From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q0KENh1Q010130 for ; Fri, 20 Jan 2012 15:23:43 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgECAPB3GU/RVdU2kGdsb2JhbABDgw2Bd6h2CCIBAQEBCQkNBxQEIYFyAQEBBBICDxUIARscAQEDDAYFCwMKAgIFFgsCAgkDAgECARERAQUBHAYNAQcBAR6jIgqLIkiCb4R2P4hxAgULgSSJYYEWBIg8jF2FVYE3hwQ9hBw X-IronPort-AV: E=Sophos;i="4.71,542,1320620400"; d="scan'208";a="140747172" Received: from mail-yw0-f54.google.com ([209.85.213.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 20 Jan 2012 15:23:43 +0100 Received: by yhfs35 with SMTP id s35so326844yhf.27 for ; Fri, 20 Jan 2012 06:23:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=jsF4WH1zQKej3xIvokJdnGxeiPB5N50rywjHiVh6Ju4=; b=UYpBIDqnl0zQoq35EwDOSMRD9MRPQPB9u+fNzsT1kTZwlQgzVu24dMA+ZpuDLGTsAs cKKSzRkbQQaaHo8h9zVu79gOORx6rbPCw4IunstezrDVs7MzB9lb+dFwy3woePeWcLLD DILxqeqmlPr5vqmY9wWvnhg4I54IpG1J2ZmPo= Received: by 10.236.191.134 with SMTP id g6mr44898044yhn.95.1327069422407; Fri, 20 Jan 2012 06:23:42 -0800 (PST) Received: from [192.168.1.65] (99-121-78-10.lightspeed.lnngmi.sbcglobal.net. [99.121.78.10]) by mx.google.com with ESMTPS id j11sm8505924anl.8.2012.01.20.06.23.40 (version=SSLv3 cipher=OTHER); Fri, 20 Jan 2012 06:23:41 -0800 (PST) Message-ID: <4F1978EB.3070409@gmail.com> Date: Fri, 20 Jan 2012 09:23:39 -0500 From: Edgar Friendly User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 MIME-Version: 1.0 To: David Allsopp CC: "caml-list@inria.fr" References: <4F196C25.7070402@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] is there a more concise way to write this? On 01/20/2012 09:12 AM, David Allsopp wrote: > Maybe for this case with two variables, yes - but it can't do that indefinitely: as the number of variables increases, the code size increases exponentially. true, the right way to generalize this is to use vuillion's `maybe` function that prepends conditionally. My main point is that the original match statement is not bad in efficiency, and does, in fact, run 35% faster for the 2-variable case. E.