title: Where clause in haskell function without parameters
body: <pre><code>substitute':: (Eq a)=&gt; a -&gt; a -&gt; [a] -&gt; [a]
  substitute' x y = map substituteOne
                    where
                      substituteOne x' | x == x'   = y
                                       | otherwise = x'
  </code></pre>
  
  <p>So, the point of this function is, that it takes two inputs of type a and a list of type a and substitutes all elements in list [a] that are from the "first" a with the "second" a. At least that is what the task description says.</p>
  
  <p>I already implemented a recursive version, but a function with a where clause is also needed.</p>
  
  <p>So THAT is the solution for it. Somehow I have questions:</p>
  
  <ol>
  <li>how can substituteOne in the second line work without any parameters?</li>
  <li>where do we give a list as input? or where do we state WHAT we do with that list? I mean compiling and eecuting it works, but somehow I don't see it</li>
  <li>what is x' ? it is never defined anywhere, we just start working with it somehow (maybe refers also to question 1) </li>
  <li>map needs a function and a list, so that it works. here we have map function _. refers maybe to 2., but what would be the output of substituteOne x' ? </li>
  </ol>
  
  <p>If needed, result looks like this:</p>
  
  <pre><code>substitute' 5 10 [1, 5, 2, 5, 3, 5]
  [1,10,2,10,3,10]
  </code></pre>