caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sven LUTHER <luther@dpt-info.u-strasbg.fr>
To: Chris Hecker <checker@d6.com>
Cc: caml-list@inria.fr
Subject: Re: anonymous function + lable bug?
Date: Tue, 7 Nov 2000 14:40:55 +0100	[thread overview]
Message-ID: <20001107144055.C30034@lambda.u-strasbg.fr> (raw)
In-Reply-To: <4.3.2.7.2.20001105044616.00ababc0@shell16.ba.best.com>; from checker@d6.com on Sun, Nov 05, 2000 at 05:11:11AM -0800

On Sun, Nov 05, 2000 at 05:11:11AM -0800, Chris Hecker wrote:
> 
> Is this a bug?
> 
> # let f = fun ~x -> x;;
> val f : x:'a -> 'a = <fun>
> 
> # let g = function ~x -> x;;
> Characters 17-18:
> Syntax error
> 
> I thought these two were equivalent?

No, function has only one argument, and can do more kind of polymorphism than 
fun which can take more than one argument as in :

let f = fun x y z -> x + y + z
f 5 6 7 evaluates to 18.

I think the use of function is preferable over fun, which is there for
compatibility reasons.

not sure what the ~ does, i think it is one of the label stuffs.

Try :

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

Don't know why there is a problem with the above though.

Friendly,

Sven Luther



  parent reply	other threads:[~2000-11-08 17:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-05 13:11 Chris Hecker
2000-11-07  2:52 ` Jacques Garrigue
2000-11-07 19:03   ` Chris Hecker
2000-11-08  1:01     ` Jacques Garrigue
2000-11-07 13:40 ` Sven LUTHER [this message]
2000-11-08 19:14   ` Chris Hecker

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=20001107144055.C30034@lambda.u-strasbg.fr \
    --to=luther@dpt-info.u-strasbg.fr \
    --cc=caml-list@inria.fr \
    --cc=checker@d6.com \
    /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;
as well as URLs for NNTP newsgroup(s).