3 ms·
In ML you can get a similar terseness to that of Haskell, but with support for imperative programming. If we allow the increment function to be predefined (as
by rkts 19y ago
In ML you can get a similar terseness to that of Haskell, but with support for imperative programming. If we allow the increment function to be predefined (as the Arc example does):
let inc a b = a := !a +/ b; !a
then foo becomes:
let foo n = inc (ref n)
or, with the help of the composition operator:
let (<<) f g x = f (g x)
let foo = inc << ref