caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Applying labeled function without a label
@ 2013-07-10 13:48 Ivan Gotovchits
  2013-07-10 15:02 ` John Carr
  2013-07-10 15:05 ` Alain Frisch
  0 siblings, 2 replies; 5+ messages in thread
From: Ivan Gotovchits @ 2013-07-10 13:48 UTC (permalink / raw)
  To: caml-list



Please, can someone explain the reason behind the following behaviour:


# let f ~a = a;;
val f : a:'a -> 'a = <fun>

if I apply function f, omiting the label, instead of an error I'll get:

# f 12;;
- : a:(int -> 'a) -> 'a = <fun>

... a function that accepts a labeled arguments, that is a function from int
to 'a, and returns a result of this function:

# f 12 ~a:(fun x -> x + 1);;
- : int = 13

and even more, if I apply it to more unlabled arguments:

# f 1 2 3 4 5;;
- : a:(int -> int -> int -> int -> int -> 'a) -> 'a = <fun>

It is very confusing...

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-07-10 15:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <51DD79B6.9030306@libertysurf.fr>
2013-07-10 15:12 ` [Caml-list] Applying labeled function without a label r.3
2013-07-10 13:48 Ivan Gotovchits
2013-07-10 15:02 ` John Carr
2013-07-10 15:13   ` r.3
2013-07-10 15:05 ` Alain Frisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).