title: Haskell Function Application
body: <p>A bit of a neophyte haskell question, but I came across this example in Haskell's <a href="http://www.haskell.org/haskellwiki/99_questions/1_to_10" rel="noreferrer">tutorial examples</a>.  For "find the last element of a list" there are some obvious versions, like </p>
  
  <pre><code>last' [x] = x
  last' (_:xs) = last' xs
  </code></pre>
  
  <p>But I can't make sense of an alternate version presented: </p>
  
  <pre><code>myLast' = foldr1 (const id)
  </code></pre>
  
  <p>So, in trying to make sense of what the application of the id function is doing, I tried in ghci:</p>
  
  <pre><code>const id 1 2 -&gt; gives 2
  </code></pre>
  
  <p>This binds like this:</p>
  
  <pre><code>(const id) 1 2 -&gt; gives 2
  </code></pre>
  
  <p>And not like this:</p>
  
  <pre><code> const (id 1) 2 -&gt; gives 1 
  </code></pre>
  
  <p>But I'm not making sense of this. <code>(const id)</code> should translate to something like </p>
  
  <pre><code>`(\x y-&gt;x) (\x-&gt;x)` 
  </code></pre>
  
  <p>Shouldn't this return a function that simply returns the id of its first element? Or, how is the function order making (const id) behave differently than const? </p>