Monday, November 8, 2010

F# continuation

Another sample of F# continuation passing style (CPS).

let F01 list =
            let rec FF list cont =
                match list with
                    | [] -> cont(0)
                    | h::t -> FF t (fun x -> cont(h+x))
            FF list (fun x-> x)

No comments: