title: count number of chars in String
body: <p>In SML, how can i count the number of appearences of chars in a String using recursion?
  Output should be in the form of (char,#AppearenceOfChar).
  What i managed to do is  </p>
  
  <pre><code>    fun frequency(x) = if x = [] then [] else [(hd x,1)]@frequency(tl x)
  </code></pre>
  
  <p>which will return tupels of the form (char,1). I can too eliminate duplicates in this list, so what i fail to do now is to write a function like</p>
  
  <pre><code>    fun count(s:string,l: (char,int) list) 
  </code></pre>
  
  <p>which 'iterates' trough the string incrementing the particular tupel component. How can i do this recursively? Sorry for noob question but i am new to functional programming but i hope the question is at least understandable :)</p>