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 q0LIYWlQ014172 for ; Sat, 21 Jan 2012 19:34:32 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgYBAP0DG09KfVI0imdsb2JhbABCrhAIIgEBAQoJDQcSBiGBcgEBAQQSAhMZARsdAQMMBgULDS4iAREBBQEcBhMiolgKi2qCb4QoP4hxAgULjBsElRiOET2EAA X-IronPort-AV: E=Sophos;i="4.71,548,1320620400"; d="scan'208";a="140879885" Received: from mail-ww0-f52.google.com ([74.125.82.52]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 21 Jan 2012 19:34:27 +0100 Received: by wgbdq12 with SMTP id dq12so1956692wgb.9 for ; Sat, 21 Jan 2012 10:34:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=dY8hk7Qtjn4YBgzDQ6OQrGaj/emjTi0bLM82xqKfBms=; b=CvI4VnHfbyeo8B17AYzJ0sPRThpuwi4MlzrGlRByis2hfFWacSLg3E0vwto3oHt2PM fsFWTkVg0B/jFTI4vmU/LandT+fCRsi6NJRUB2DLWzP4sZgjMIXTuV4VAl1DxyjIsA9E 1J+FENirYco2nnXpGkeeTZsBiooILmgRekbRM= Received: by 10.180.93.168 with SMTP id cv8mr4914554wib.2.1327170867202; Sat, 21 Jan 2012 10:34:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.227.198.147 with HTTP; Sat, 21 Jan 2012 10:33:46 -0800 (PST) In-Reply-To: References: From: Gabriel Scherer Date: Sat, 21 Jan 2012 19:33:46 +0100 Message-ID: To: Pierre Chopin Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id q0LIYWlQ014172 Subject: Re: [Caml-list] pattern matching on integer intervals I believe your best bet is the 'if .. then .. else' chain. You may also use 'when' clauses in pattern matching, but those don't scale too well and are best avoided if their are the only content of your content: pattern matching are good for structural deconstruction and environment binding, but can be confusing and useless when you are using none of those aspects. On Sat, Jan 21, 2012 at 7:14 PM, Pierre Chopin wrote: > Hi, > > I am trying to do pattern matching on unicode characters, represented by > integers. I would like to do something like that > >  let f c = >  match c with >    0xff .. 0xfff -> foo > > I know we can pattern match over char intervals but It doesn't be to be the > case for char intervals. Some I have two questions: >  Is there a better way of doing what I am doing and why is it possible to > pattern match over char intervals and not int intervals? > > -- > Pierre Chopin, > Chief Technology Officer and co-founder > punchup LLC > pierre@punchup.com >