News for hackers. Stuff that matters.
Re:Fantastic DSLs and where to find them by Veedrac on Thursday June 29, 2017 @03:40PM (#14666241)
FWIW, this can be inferred fully automatically. Type

    let pair = fun x -> fun y -> { _0 = x; _1 = y }

    let rec reduce = fun init -> fun combine -> fun xs ->
        match xs with
            [] -> init
          | x :: rest -> reduce (combine x init) combine rest

    let test = reduce 0 pair [1; 2; 3; 4]
into https://www.cl.cam.ac.uk/~sd601/mlsub/ to see a demonstration.

There are no comments on this comment yet.