title: Implement a function to count frequency of each element in a list
body: <p>I try to write a program which will count the frequency of each element in a list.</p>
  
  <pre><code>    In: "aabbcabb"
      Out: [("a",3),("b",4),("c",1)]
  </code></pre>
  
  <p>You can view my code in the following link: <a href="http://codepad.org/nyIECIT2" rel="noreferrer">http://codepad.org/nyIECIT2</a>
  In this code the output of unique function would be like this</p>
  
  <pre><code>     In: "aabbcabb"
       Out: "abc"
  </code></pre>
  
  <p>Using the output of unique we wil count the frequency of the target list.
  You can see the code here also:</p>
  
  <pre><code>    frequencyOfElt xs=ans
         where ans=countElt(unique xs) xs
            unique []=[]
        unique xs=(head xs):(unique (filter((/=)(head xs))xs))
        countElt ref target=ans'
               where ans'=zip ref lengths
              lengths=map length $ zipWith($)(map[(=='a'),(==',b'),(==',c')](filter.(==))ref)(repeat target)
  
      Error:Syntax error in input (unexpected symbol "unique") 
  </code></pre>
  
  <p>But in ghci 6.13 other type of error are showing also</p>
  
  <p>Few asked me what is the purpose of using [(=='a'),(==',b'),(==',c')]. 
  What I expect: If ref="abc" and target="aabbaacc"
  then</p>
  
  <pre><code>    zipWith($) (map filter ref)(repeat target)
  </code></pre>
  
  <p>will show ["aaaa","bb","cc"] then I can use map length over this to get the frequency
  Here for filtering list according with the ref i use [(=='a'),(==',b'),(==',c')]</p>
  
  <p>I assume some logical error lies [(=='a'),(==',b'),(==',c')] here..</p>