Browse thread
[Caml-list] Question
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2003-12-03 (14:01) |
From: | Damien Doligez <damien.doligez@i...> |
Subject: | Re: [Caml-list] Question |
On Monday, December 1, 2003, at 04:41 PM, sebastien FURIC wrote: > # let test t t' = match t, t' with > | ((Toto _ | Titi _), Toto x | Toto x, (Toto _ | Titi _)) when x = 0 > -> "OK" > | _ -> "KO";; > Characters 73-79: > Warning: this pattern is unused. > | ((Toto _ | Titi _), Toto x | Toto x, (Toto _ | Titi _)) when x = 0 > -> "OK" > ^^^^^^ [...] > I was expecting "when" to be right distributive over "|". That notion doesn't make sense because "when" is not a pattern operator. If you "distribute" when over |, you get this: # let test t t' = match t, t' with | ((Toto _ | Titi _), Toto x when x = 0 | Toto x, (Toto _ | Titi _) when x = 0) -> "OK" | _ -> "KO";; which is nonsense, from O'Caml's point of view. -- Damien ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners