Harper gives an improved version of reduce()

fun staged reduce (unit, opn) =
let
fun red nil = unit
  | red (h::t) = opn (h, red t)
in
  red
end

and states:

We could just as well have replaced the body of the let expression with the function   fn l => red l  but a momentÂ’s thought reveals that the meaning is the same.

now, how do we call this subroutine?

hang onto your hats:

  staged_reduce  (0, (op +)) [4,5,6] ; 

AmomentsThoughtRevealsTheyAreTheSame (last edited 2008-07-09 05:48:14 by localhost)