[MLton] handling a variable number of arguments in SML
   
    Vesa Karvonen
     
    vesa.karvonen@cs.helsinki.fi
       
    Wed, 24 Aug 2005 05:58:33 +0300
    
    
  
Quoting Stephen Weeks <sweeks@sweeks.com>:
[snip snip]
>       val () = p (fold (0, op +) (a 1) (a 2) (a 3) $)
>       val () = p (fold (0, op +) (a 1 & a 2 & a 3))
> I'm unsure of what advantage, if any, the continuation approach has
> over the composition-of-arguments approach.
I just remembered the specific reason why I liked the notation using
lists better than the notation using composition. [] provides a natural
way of referring to the defaults (empty set of updates to the defaults).
The function application/CPS technique also allows you to express the
empty set of updates naturally, but the composition technique needs an
extra symbol.
  CPS:   f $     f (a) $     f (a) (b) $
  o/&:   f id    f (a)       f (a & b)
   []:   f []    f [a]       f [a, b]
I find the list notation the nicest. Too bad it has a performance
disadvantage.
-Vesa Karvonen