Here's another puzzle:

Is it possible in OCaml to define a variable-argument function? For example, can one define a function f and values a and z such that the following assertions hold:

  1.  
  2. assert (f z = 0);
  3. assert (f a z = 1);
  4. assert (f a a z = 2);
  5. assert (f a a a z = 3);
  6. ...

Once you've got that, how about generalizing it to a variable-argument sum, i.e. define

f, a, and z such that:

  1. assert (f (a i1) (a i2) ... (a ik) z = i1 + i2 + ... + ik);

Or, if you want to eliminate the parens, define an f, a, and z such that:

  1. assert (f a i1 a i2 ... a ik z = i1 + i2 + ... + ik);