English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Patterns that evaluate
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-02-14 (20:29)
From: Nathaniel Gray <n8gray@g...>
Subject: Re: [Caml-list] Patterns that evaluate
On 2/13/07, Jacques Carette <carette@mcmaster.ca> wrote:
> I recently wrote some ocaml code which "worked", but not as I
> intended...  The test cases I tried worked, but I should have tested
> harder.  Apparently I was under the mistaken impression that OCaml's
> pattern-matching was more "first class"!  So I wrote (in part):
> let buildsimp cast e f1 f2 = fun e1 -> fun e2 -> match (e1,e2) with
>                                                  | ({st = Some e}, _) -> e2
> and I expected it to work.  Only a code review by a colleague 'found'
> this bug in my code.

I guess I'm not seeing it.  How did you expect it to work?  Is this
what you mean:

... | ({st = Some v}, _) when v = e -> e2

Is there some functionality that you're looking for that when clauses
don't provide?


>>>-- Nathaniel Gray -- Caltech Computer Science ------>
>>>-- Mojave Project -- http://mojave.cs.caltech.edu -->