<?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="2002/07/5e416daa06a94c2263de024975bd8d01"
  from="Michael Vanier &lt;mvanier@c...&gt;"
  author="Michael Vanier"
  date="2002-07-20T14:28:47"
  subject="Re: [Caml-list] Pattern matching missing (or brain damage?)"
  prev="2002/07/cfac32c08aafecbb2414ee0832350833"
  next="2002/07/9a963490c21609d7d83588ce4832767b"
  prev-in-thread="2002/07/19d0749808ad9a6879697110271dcf77"
  next-in-thread="2002/07/a342bcbb91ef8be2b62a7efea688671f"
  prev-thread="2002/07/444e872df95c217576d95f578cc60764"
  next-thread="2002/07/315f6c499a501e6f0b02d1bddacd4ee1"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Pattern matching missing (or brain damage?)">
<msg 
  url="2002/07/c22d9fd21bcea5691f5678e925df1862"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-18T22:15:33"
  subject="[Caml-list] Pattern matching missing (or brain damage?)">
<msg 
  url="2002/07/604fa7b6902a2b44dae753400c7915df"
  from="William Lovas &lt;wlovas@s...&gt;"
  author="William Lovas"
  date="2002-07-19T00:09:04"
  subject="Re: [Caml-list] Pattern matching missing (or brain damage?)">
<msg 
  url="2002/07/19d0749808ad9a6879697110271dcf77"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-19T01:02:02"
  subject="Re: [Caml-list] Pattern matching missing (or brain damage?)">
</msg>
</msg>
<msg 
  url="2002/07/5e416daa06a94c2263de024975bd8d01"
  from="Michael Vanier &lt;mvanier@c...&gt;"
  author="Michael Vanier"
  date="2002-07-20T14:28:47"
  subject="Re: [Caml-list] Pattern matching missing (or brain damage?)">
<msg 
  url="2002/07/a342bcbb91ef8be2b62a7efea688671f"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-20T15:26:53"
  subject="Re: [Caml-list] Pattern matching missing (or brain damage?)">
</msg>
</msg>
</msg>
</thread>

<contents>


# type ex = A of int | B of int | C of int | D of int | E of int;;
type ex = A of int | B of int | C of int | D of int | E of int
# let a = A 1000;;
val a : ex = A 1000
# match a with
     A(_) | B(_) | C(_) -&gt; "foo"
  |  C(_) | D(_) | E(_) -&gt; "bar";;
- : string = "foo"

You put in an extra | before the A(_).

Mike


&gt; Date: Fri, 19 Jul 2002 00:22:44 +0200
&gt; From: Alessandro Baretta &lt;alex@baretta.com&gt;
&gt; 
&gt; I believe I remember a pattern matching construct where an 
&gt; expression could be associated with multiple patterns.
&gt; 
&gt; match &lt;expr&gt; with
&gt; | A(_) | B(_) | C(_) -&gt; foo
&gt; | C(_) | D(_) | E(_) -&gt; bar
&gt; 
&gt; Neither does the compiler accept such code, nor does the 
&gt; manual mention such construct. Has it been removed from the 
&gt; language or am I suffering severe brain damage from too much 
&gt; O'Caml coding?
&gt; 
&gt; Alex
&gt; 
&gt; -------------------
&gt; To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
&gt; Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
&gt; Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
&gt; 
-------------------
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>

