[ create a new paste ] login | about

Link: http://codepad.org/HSA0del7    [ raw code | output | fork ]

OCaml, pasted on Nov 23:
1
2
3
4
5
6
7
8
9
10
11
type polyapp = { f : 'a. 'a list -> unit; }

let a = [1;2;3]
let b = ["ss"; "bb"]

let apply { f = f } =
  f a;
  f b

let () =
  apply { f = (fun l -> Printf.printf "length %d\n" (List.length l)) }


Output:
1
2
length 3
length 2


Create a new paste based on this one


Comments: