« Return to Thread: A simple question about a function

A simple question about a function

by Msam85 :: Rate this Message:

Reply to Author | View in Thread

HI everyone.

I'm new in Ocaml language, and I had tried to understand the following function, but Im not able.

let op = function
  p->fst p (snd p);;

If I put it at the top level it shows me :
val op :     ('a->'b)*'a ->'b = <fun>

I think that p must be like ( , )  but if i trie to write op((+),3);;
It shows me   -: int -> int = <fun>

Can somebody tell me how this function works and what does it do ?
Thank you in advance

 « Return to Thread: A simple question about a function