title: Haskell compare all list items
body: <p>Edit: it's hard to describe what I'm trying to do, but here's a try (from the comments):</p>
  
  <p>I am building a wordfeud solver, so I have a word, and some letters (both char list). I applied this ( <a href="https://stackoverflow.com/questions/7108559/how-to-find-the-frequency-of-characters-in-a-string-in-haskell">How to find the frequency of characters in a string in Haskell?</a> ) to both lists to get the frequency of all letters. What I'm doing now is iterating though the 'word' char list, and checking if all chars occur sufficiently in the 'letters' char list.</p>
  
  <p>I have written a Haskell function that compares two lists by applying a function to the items of both lists, and comparing the results.</p>
  
  <p>The comparison is done like this:</p>
  
  <pre><code>hasLetters' :: [Char] -&gt; [Char] -&gt; Bool
  hasLetters' word letters = (getCharOccurrence (head word) (getCharOccurrences word)) &lt;= (getCharOccurrence (head word) (getCharOccurrences letters))
  </code></pre>
  
  <p>This only compares the occurrences of the first letter of the word. But ALL words should be compared (and the result should be TRUE for all of them).</p>
  
  <p>I don't really know how to accomplish this. I found the 'all' method that lets me define a predicate, that's pretty good. It looks like this:</p>
  
  <pre><code>all (&lt;= (getCharOccurrence (head word) (getCharOccurrences letters))) 
  </code></pre>
  
  <p>(I think that's correct)
  It makes sure that every item that goes into the list is smaller than or equal to the result of the provided function.</p>
  
  <p>BUT: the 'all' method needs another parameter. This would be the 'source' parameter that defines what should be compared to the predicate. This would be easy when this were just a list, then I would do something like this:</p>
  
  <pre><code>all (&lt;= (getCharOccurrence (head word) (getCharOccurrences letters))) [0..10]
  </code></pre>
  
  <p>But the problem is: I dont have a list of results like this, I need to compare it to the result of:</p>
  
  <pre><code>(getCharOccurrence (head word) (getCharOccurrences letters))
  </code></pre>
  
  <p>I figured that I could apply this function to every character in the 'word' char list with the 'map' function, but I dont know how to use it. I started like this:</p>
  
  <pre><code>map (getCharOccurrence (head word) (getCharOccurrences word)) word
  </code></pre>
  
  <p>But that's wrong.</p>
  
  <p>So what I (think I) need: apply the above function to all characters of the 'word' char list, and compare it to the predicate.</p>
  
  <p>But maybe I'm just think the wrong way. I'm an absolute Haskell/functional programming newbie. Please help me out :-)</p>