<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/12/928ebdb82757524a715d3934786a2a64"
  from="sebastien FURIC &lt;sebastien.furic@t...&gt;"
  author="sebastien FURIC"
  date="2003-12-01T18:06:41"
  subject="Re: [Caml-list] Question"
  prev="2003/12/e78561a3930717ed85eecf809e6dfd38"
  next="2003/12/50bb73b39cc484fbbec77b6fee08aa8d"
  prev-in-thread="2003/12/e78561a3930717ed85eecf809e6dfd38"
  next-in-thread="2003/12/c9c38da4d98cb927dc5e77c8fe1605c9"
  prev-thread="2003/12/cf645abf5fbb4bfeb95e8a52ae1ca918"
  next-thread="2003/12/50bb73b39cc484fbbec77b6fee08aa8d"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Question">
<msg 
  url="2003/12/035f1d364ebb8d8bd82cfe75d186759a"
  from="sebastien FURIC &lt;sebastien.furic@t...&gt;"
  author="sebastien FURIC"
  date="2003-12-01T15:43:11"
  subject="[Caml-list] Question">
<msg 
  url="2003/12/e78561a3930717ed85eecf809e6dfd38"
  from="Remi Vanicat &lt;vanicat@l...&gt;"
  author="Remi Vanicat"
  date="2003-12-01T17:48:10"
  subject="Re: [Caml-list] Question">
<msg 
  url="2003/12/928ebdb82757524a715d3934786a2a64"
  from="sebastien FURIC &lt;sebastien.furic@t...&gt;"
  author="sebastien FURIC"
  date="2003-12-01T18:06:41"
  subject="Re: [Caml-list] Question">
</msg>
</msg>
<msg 
  url="2003/12/c9c38da4d98cb927dc5e77c8fe1605c9"
  from="Damien Doligez &lt;damien.doligez@i...&gt;"
  author="Damien Doligez"
  date="2003-12-03T14:01:41"
  subject="Re: [Caml-list] Question">
</msg>
<msg 
  url="2003/12/3f8a533bf7e11400eeb0d02ff50c1716"
  from="Pierre Weis &lt;pierre.weis@i...&gt;"
  author="Pierre Weis"
  date="2003-12-10T10:28:02"
  subject="Re: [Caml-list] Question">
<msg 
  url="2003/12/1e676f8fcefbaa708f890932f7547f19"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-12-10T16:54:10"
  subject="Re: [Caml-list] Question">
<msg 
  url="2003/12/562803867fd4a377b41a8e3a465f43b7"
  from="Luc Maranget &lt;luc.maranget@i...&gt;"
  author="Luc Maranget"
  date="2003-12-11T09:52:48"
  subject="Re: [Caml-list] Question">
<msg 
  url="2003/12/00762880f710a47d94d59f5f9e80641e"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-12-11T15:20:30"
  subject="Re: [Caml-list] Question">
<msg 
  url="2003/12/aecf296ada293906c355ef91f393e249"
  from="Luc Maranget &lt;luc.maranget@i...&gt;"
  author="Luc Maranget"
  date="2003-12-11T16:56:07"
  subject="Re: [Caml-list] Question">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>


Remi Vanicat a écrit :
&gt; 
&gt; "sebastien FURIC" &lt;sebastien.furic@tni-valiosys.com&gt; writes:
&gt; 
&gt; &gt;  Hi,
&gt; &gt;
&gt; &gt;  What do you think of the following code?
&gt; &gt;
&gt; &gt; # type toto = Toto of int | Titi of string;;
&gt; &gt; type toto = Toto of int | Titi of string
&gt; &gt; # let test t t' = match t, t' with
&gt; &gt;   | ((Toto _ | Titi _), Toto x | Toto x, (Toto _ | Titi _)) when x = 0
&gt; &gt; -&gt; "OK"
&gt; &gt;   | _ -&gt; "KO";;
&gt; &gt; Characters 73-79:
&gt; &gt; Warning: this pattern is unused.
&gt; &gt;   | ((Toto _ | Titi _), Toto x | Toto x, (Toto _ | Titi _)) when x = 0
&gt; &gt; -&gt; "OK"
&gt; &gt;                                           ^^^^^^
&gt; 
&gt; I can't answer to your question, but with your example, one can do a:
&gt; 
&gt; # let test t t' = match t, t' with
&gt;   | ((Toto _ | Titi _), Toto 0
&gt;   | Toto 0, (Toto _ | Titi _)) when x = 0 -&gt; "OK"
&gt;   | _ -&gt; "KO";;
&gt; 
&gt; of course, this is not generalizable to any test.

 I could have even write:

# let test t t' = match t, t' with
  | _, Toto 0 | Toto 0, _ -&gt; "OK"
  | _ -&gt; "KO";;

 The point is that my example is extracted from a "serious" project
where I wrote something like:

| ((Toto _ | Titi _), Toto x | Toto x, (Toto _ | Titi _)) when f(x) = 0
-&gt; ...

 and where type toto has more than 2 constructors.

 Cheers,

 Sébastien.

-------------------
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

</contents>

</message>

