« Return to Thread: A simple question about a function

"ocaml_beginners"::[] Re: A simple question about a function

by gaberosenhouse :: Rate this Message:

Reply to Author | View in Thread

Look at http://en.wikipedia.org/wiki/Currying
and remember that (+) is a function of two arguments.

--- In ocaml_beginners@..., Msam85 <carloselcheca@...> wrote:

>
>
> 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
> --
> View this message in context:
http://www.nabble.com/A-simple-question-about-a-function-tf4207163.html#a11967990
> Sent from the Ocaml Beginner mailing list archive at Nabble.com.
>


 « Return to Thread: A simple question about a function