caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Pierre Chopin <pierre@punchup.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] pattern matching on integer intervals
Date: Sat, 21 Jan 2012 19:33:46 +0100	[thread overview]
Message-ID: <CAPFanBE18w_NZ+Jcy45L4DzJfG1ypqpV+SUuEc++gc0qxKW6nQ@mail.gmail.com> (raw)
In-Reply-To: <CAGyUfm3w0dnk0DwK=kGpNAb5o1b8ehEXDcC07zWLdH5BwCHf5w@mail.gmail.com>

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 <pierre@punchup.com> 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
>


  parent reply	other threads:[~2012-01-21 18:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-21 18:14 Pierre Chopin
2012-01-21 18:30 ` Till Varoquaux
2012-01-21 18:33 ` Gabriel Scherer [this message]
2012-01-21 19:46 ` Edgar Friendly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPFanBE18w_NZ+Jcy45L4DzJfG1ypqpV+SUuEc++gc0qxKW6nQ@mail.gmail.com \
    --to=gabriel.scherer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=pierre@punchup.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).