title: Sorting a list in OCaml
body: <p>Here is the code on sorting any given list:</p>
  
  <pre><code>let rec sort lst =
     match lst with
       [] -&gt; []
     | head :: tail -&gt; insert head (sort tail)
   and insert elt lst =
     match lst with
       [] -&gt; [elt]
     | head :: tail -&gt; if elt &lt;= head then elt :: lst else head :: insert elt tail;;
  </code></pre>
  
  <p>[Source: <a href="http://caml.inria.fr/pub/docs/manual-ocaml/manual003.html" rel="noreferrer">Code</a></p>
  
  <p>However, I am getting an Unbound error:</p>
  
  <pre><code>Unbound value tail
  # let rec sort lst =
     match lst with
       [] -&gt; []
     | head :: tail -&gt; insert head (sort tail)
   and insert elt lst =
     match lst with
       [] -&gt; [elt]
     | head :: tail -&gt; if elt &lt;= head then elt :: lst else head :: insert elt tail;;
  Characters 28-29:
       | head :: tail -&gt; if elt &lt;= head then elt :: lst else head :: insert elt tail;;
       ^
  Error: Syntax error
  </code></pre>
  
  <p>Can anyone please help me understand the issue here?? I did not find <code>head</code> or <code>tail</code> to be predefined anywhere nor in the code</p>