<?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/11/4d893cc52b22fe3904f8f579fcf78b2d"
  from="chris.danx &lt;chris.danx@n...&gt;"
  author="chris.danx"
  date="2003-11-18T00:18:22"
  subject="[Caml-list] Records: syntax error..."
  prev="2003/11/71a9f6b1c9c662f86ec7cd16addcc659"
  next="2003/11/c5e9aace0d2e0cee5765b5fd98eb520d"
  next-in-thread="2003/11/c5e9aace0d2e0cee5765b5fd98eb520d"
  prev-thread="2003/11/398e682363175b0a71bf952390df0eae"
  next-thread="2003/11/6da311da670a99572f6a1091fd48e228"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Records: syntax error...">
<msg 
  url="2003/11/4d893cc52b22fe3904f8f579fcf78b2d"
  from="chris.danx &lt;chris.danx@n...&gt;"
  author="chris.danx"
  date="2003-11-18T00:18:22"
  subject="[Caml-list] Records: syntax error...">
<msg 
  url="2003/11/c5e9aace0d2e0cee5765b5fd98eb520d"
  from="Aleksey Nogin &lt;nogin@c...&gt;"
  author="Aleksey Nogin"
  date="2003-11-18T00:40:57"
  subject="Re: [Caml-list] Records: syntax error...">
<msg 
  url="2003/11/eb05995e3d523b2303ba34dba1bbf2c3"
  from="chris.danx &lt;chris.danx@n...&gt;"
  author="chris.danx"
  date="2003-11-18T14:31:08"
  subject="Re: [Caml-list] Records: syntax error...">
</msg>
</msg>
</msg>
</thread>

<contents>
Hi,

I'm working my way through the ocaml book, and came across one exercise 
I can't get to work (sort of).  The exercise asked to define insert over 
the following type

type 'a dList =
   {l: 'a list; compare : 'a -&gt; 'a -&gt; bool; in_order : bool};;

I can get it to work with code similar to the solution, but since I had 
defined a merge function in the same file I decided to try using pattern 
matching on the record...


let insert item dl =
   match dl with
       {l = _; compare = _; in_order = true}  -&gt;
               {merge dl.compare (dl.l, [item]), dl.compare, true}
     | {l = _; compare = _; in_order = false} -&gt;
               {item::dl.l, dl.compare, false};;

but ocaml complains of a syntax error at dl.compare.  What did I do wrong?



Thanks,
Chris

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

