[Caml-list] pattern matching on integer intervals

2012-01-21 Thread Pierre Chopin
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

Re: [Caml-list] pattern matching on integer intervals

2012-01-21 Thread Till Varoquaux
I remember wondering the same thing and the answer can be found in the ocaml parser: char intervals are expanded at parse time to the the full list of characters. This would blow up if you were to use ints, int64 etc HTH, Till On Sat, Jan 21, 2012 at 1:14 PM, Pierre Chopin pie...@punchup.com

Re: [Caml-list] pattern matching on integer intervals

2012-01-21 Thread Gabriel Scherer
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

Re: [Caml-list] pattern matching on integer intervals

2012-01-21 Thread Edgar Friendly
On 01/21/2012 01: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