caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jonathan Roewen" <jonathan.roewen@gmail.com>
To: "Jon Harrop" <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] recursion/iterator question
Date: Tue, 18 Apr 2006 15:25:03 +1200	[thread overview]
Message-ID: <ad8cfe7e0604172025lba835f1la030f98f171c3e2b@mail.gmail.com> (raw)
In-Reply-To: <200604171807.47687.jon@ffconsultancy.com>

> >   let rec combs = function
> >
> >       | (0, _) -> [[]]
> >       | (n, es) when n > List.length es -> []
> >       | (n, e::es) -> List.map (fun l -> e::l) (combs (n-1, es)) @ combs
> >       | (n, es)
> >
> >   let triplets es = combs (3, es)
> >
> > Question to the rest of the list:  The ocaml compiler complains with
> >   ...
> >   Warning P: this pattern-matching is not exhaustive.
> >   Here is an example of a value that is not matched:
> >   (1, [])
> >   (However, some guarded clause may match this value.)

Personally, if you know it can never be reached, then an assertion is
probably better.

| otherwise -> assert false (* I prefer using a name like otherwise
rather than _ for pure readability value *)

Jonathan


  reply	other threads:[~2006-04-18  3:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-16 21:11 Tato Thetza
2006-04-16 22:00 ` [Caml-list] " David Powers
2006-04-16 22:27 ` Martin Jambon
2006-04-17  0:06 ` Jon Harrop
2006-04-17  9:36   ` Christian Stork
2006-04-17 17:07     ` Jon Harrop
2006-04-18  3:25       ` Jonathan Roewen [this message]
2006-04-18  8:58       ` Christian Stork
2006-04-18 16:15         ` Christian Stork
2006-04-20 11:53     ` Damien Doligez
2006-04-17  6:50 ` Li-Thiao-Té Sébastien
2006-04-17 11:26   ` Nils Gesbert
2006-04-17 13:09 ` Xavier Leroy

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=ad8cfe7e0604172025lba835f1la030f98f171c3e2b@mail.gmail.com \
    --to=jonathan.roewen@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=jon@ffconsultancy.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).