title: haskell: factorial using high order function
body: <p>I'm trying to recreate a factorial function, eg fac 1 = 1, fac 2 = 2, fac 3 = 6 by using high order functions but I'm not having much luck. My fold function keeps returning the empty list no matter what inputs I'm giving it. Can anyone help me out?</p>
  
  <p>Here's what I have so far: </p>
  
  <pre><code>fold f a [] = []
  fold f a (x:xs) = fold f (f a x) xs
  
  
  fac n = fold (*) 1 [1..n]
  </code></pre>