title: Defining foldl in terms of foldr in Standard ML
body: <p>The defined code is </p>
  
  <pre><code>fun foldl f e l = let
      fun g(x, f'') = fn y =&gt; f''(f(x, y)) 
      in foldr g (fn x =&gt; x) l e end
  </code></pre>
  
  <p>I don't understand how this works; 
  what is the purpose of <code>g(x, f'')</code>?</p>
  
  <p>I also find a similar example in Haskell,
  the definition is quite short</p>
  
  <pre><code>myFoldl f z xs = foldr step id xs z
      where
          step x g a = g (f a x)
  </code></pre>