You can get the head and the tail by pattern matching.&nbsp; Lets say you have a function that takes a list:<br><br>myfunction list = -- do something here<br><br>go = myfuction [1,4,2,6]<br><br>... you can write the &quot;list&quot; bit of the function as (x:xs), where x is the head, or first element, of the list, and xs is the tail, or the rest of the list:
<br><br>myfunction (x:xs) = -- do something here<br><br>then you can call myfunction on xs, and compare that to x, to give the result.<br><br>This is recursive: the function calls itself over and over again, until at some point it&#39;s going to execute &quot;myfuction []&quot; or &quot;myfunction [6]&quot;, which is easy to handle, for example by adding the definition:
<br><br>myfunction [a] = -- the value of myfunction given a<br><br>Go here for a really great tutorial:<br><br><a href="http://www.cs.nott.ac.uk/~gmh/book.html">http://www.cs.nott.ac.uk/~gmh/book.html</a><br><br>Recursive functions are in slides, number 6, but the tutorials are really great: just start from 1 and work your way through.
<br><br>