Search code examples
functionocamlfirst-order-logic

Can anyone work out how to test this OCAML function?


I'm working through a practice paper for an exam but there are no answers. There are a series of functions which I have to explain what they do but there is one I can't solve: fun x -> fun y -> (x y);; It has the type: ('a -> 'b) -> 'a -> 'b What am I supposed to do?


Solution

  • Try this on for size:

    let () =
      Printf.printf "The ans is: %d" ((fun x -> fun y -> (x y)) (fun x -> x + 10) 4133)