News for hackers. Stuff that matters.
Re:Functional isn't always better by fab13n on Friday October 07, 2011 @11:59AM (#3084534)

    [(x[i],x[j]) for i in range(len(x)) for j in range(i+1, len(x))]
His problem is not with functional programming (i.e. avoiding state mutations). It is that he tries to do inductive definitions and functors in a language whose syntax is extremely unsupportive. In OCaml that would be (untested code):

    let rec pairs = function
    | a :: b -> List.map (fun x -> (a, x)) b @ (pairs b)
    | [] -> []

There are no comments on this comment yet.