From: Ivan Gotovchits <ivg@ieee.org>
To: caml-list@inria.fr
Subject: [Caml-list] Applying labeled function without a label
Date: Wed, 10 Jul 2013 17:48:45 +0400 [thread overview]
Message-ID: <878v1ea5ky.fsf@golf.niidar.ru> (raw)
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...
next reply other threads:[~2013-07-10 13:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-10 13:48 Ivan Gotovchits [this message]
2013-07-10 15:02 ` John Carr
2013-07-10 15:13 ` r.3
2013-07-10 15:05 ` Alain Frisch
[not found] <51DD79B6.9030306@libertysurf.fr>
2013-07-10 15:12 ` r.3
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878v1ea5ky.fsf@golf.niidar.ru \
--to=ivg@ieee.org \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox