title: Generalized list printing function in SML
body: <p>I have to write a function to print a list in SML with the following type signature :</p>
  
  <pre><code>     val printGenList = fn : ('a -&gt; 'b) -&gt; 'a list -&gt; unit
  </code></pre>
  
  <p>The "printGenList" will take two arguments function f and list l and applies the function f to each element of list l recursively.</p>
  
  <p>Since I am new to ML, I am not able to implement it but I tried this code which is giving the different type signature</p>
  
  <pre><code>     fun printGenList = CONS(fib, fn =&gt; printGenList fib fibs);
  
   where,  fib is
          fun fib a b = CONS(a, fn =&gt; fib b (a+b));
   and fibs is
          val fibs = fib 0 1;
  </code></pre>