From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 593C27EE25 for ; Sat, 9 Nov 2013 19:39:05 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of anthony.tavener@gmail.com) identity=pra; client-ip=74.125.83.51; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="anthony.tavener@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of anthony.tavener@gmail.com designates 74.125.83.51 as permitted sender) identity=mailfrom; client-ip=74.125.83.51; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="anthony.tavener@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ee0-f51.google.com) identity=helo; client-ip=74.125.83.51; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="postmaster@mail-ee0-f51.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aj4DACeAflJKfVMzlGdsb2JhbABZgkN8U6xBkHmBX4EkCBYOAQEBAQcLCwkSKoIlAQEEAScZARsRAQsBAwELBgULDQ0hIgERAQUBChIGExKHXAEDCQYNnj6MV4MJhAYKGScDCmSJAQEFDIxpgSOBSwQHhDADiUKMaIFlgS+LI4NMGCmCZoILHA X-IPAS-Result: Aj4DACeAflJKfVMzlGdsb2JhbABZgkN8U6xBkHmBX4EkCBYOAQEBAQcLCwkSKoIlAQEEAScZARsRAQsBAwELBgULDQ0hIgERAQUBChIGExKHXAEDCQYNnj6MV4MJhAYKGScDCmSJAQEFDIxpgSOBSwQHhDADiUKMaIFlgS+LI4NMGCmCZoILHA X-IronPort-AV: E=Sophos;i="4.93,668,1378850400"; d="scan'208";a="34672350" Received: from mail-ee0-f51.google.com ([74.125.83.51]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 09 Nov 2013 19:39:04 +0100 Received: by mail-ee0-f51.google.com with SMTP id t10so1618984eei.38 for ; Sat, 09 Nov 2013 10:39:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7j5qM95LbuZdyhuvpHQ/Eqb6qwzEw1dd18O1UDrv8rQ=; b=dYsPhgWzwMsAbMHRQliUcd6Up70THEgWCzVSdSnKONMRTibdOai//zvD20edRwNKZu ZCV5sjT53nVBohKQbKqGDO54UY/gRbs78fHSfkR1DoyAh3W00moQRKj0SRxdrk+mJApu mNo9/EgV8KdkozTlv29EUUwnL6FqmxflW46SzeJI9Kk3NXTDH69VZUjTjMAg9sXxlQqU wnjTzAKBI5NuwxXW13zLucb731ycinHmUi0C0wEDqO7qI28+2w+4nyR4b8WqPNECvu8Q yvyAjb4shQ9EuJPIS0RCYKfTny/4/G9ZaJesj7XzF3uNZrI95TrXmfkdLZwgl9U5kPaE e7tA== MIME-Version: 1.0 X-Received: by 10.14.221.73 with SMTP id q49mr24263810eep.25.1384022343927; Sat, 09 Nov 2013 10:39:03 -0800 (PST) Received: by 10.15.90.205 with HTTP; Sat, 9 Nov 2013 10:39:03 -0800 (PST) In-Reply-To: <1384019828.3098.YahooMailNeo@web160502.mail.bf1.yahoo.com> References: <1383968015.11272.YahooMailNeo@web160505.mail.bf1.yahoo.com> <20131109100726.GA4014@kerneis.info> <1384019828.3098.YahooMailNeo@web160502.mail.bf1.yahoo.com> Date: Sat, 9 Nov 2013 11:39:03 -0700 Message-ID: From: Anthony Tavener To: Jean Saint-Remy Cc: Gabriel Kerneis , "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=047d7b6250a42bcd8a04eac2d0f6 Subject: Re: [Caml-list] applying labled argument error --047d7b6250a42bcd8a04eac2d0f6 Content-Type: text/plain; charset=ISO-8859-1 This is a bit of a pickle. For Real World OCaml to be a great book for OCaml almost requires Core to become the stdlib. Core is a pretty nice body of work, but I'm not a user of it myself, and I've been unable to decide if I'd like it as the standard library. There is a very strong flavor to the style. I suppose the official standard library has a bit of an "exceptional" flavor, but aside from that I feel it doesn't impose anything. Jean, for you example, the List.iter line using the standard library would be: List.iter (fun x -> sum := !sum + x) list; This kind of confusion is certainly not good for learning a language though! To resolve this, we need to clone a single person three times and send each into an alternate future: one continuing with standard library as-is, one with Core, and one with Batteries. Then bring them back so they can argue amongst each other about what was better. :) On Sat, Nov 9, 2013 at 10:57 AM, Jean Saint-Remy wrote: > Hi, > > I've been working out some of the examples in the > https://realworldocaml.org/v1/en/html/a-guided-tour.html, which does > utilize JaneStreet 'core' library. The new ocaml website is very > impressive, as it allows you to dive right in into very fascinating > idiomatic ocaml expressions. Just launching ocaml toplevel though is not > enough. > > let sum list = > let sum = ref 0 in > List.iter list ~f:(fun x -> sum := !sum + x); > !sum ;; > -: Error: The function applied to this argument has type 'a list -> unit > This argument cannot be applied with label ~f > > Jean > > > On Saturday, November 9, 2013 5:07 AM, Gabriel Kerneis < > gabriel@kerneis.info> wrote: > On Fri, Nov 08, 2013 at 07:33:35PM -0800, Jean Saint-Remy wrote: > > I am running ocaml 3.12.1 and getting an error message. Is it an > incompatible > > version error or a missing 'core' module? > > Since you mention 'core', are you learning OCaml with "Real-World OCaml" > (and > hence trying to use JaneStreet's Core library instead of the standard one)? > That would explain the discrepancy you are seeing. > > > Best, > > -- > Gabriel > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > > > --047d7b6250a42bcd8a04eac2d0f6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
This is a bit of a pickle. For Real World OCaml to be a gr= eat book for OCaml almost requires Core to become the stdlib. Core is a pre= tty nice body of work, but I'm not a user of it myself, and I've be= en unable to decide if I'd like it as the standard library. There is a = very strong flavor to the style. I suppose the official standard library ha= s a bit of an "exceptional" flavor, but aside from that I feel it= doesn't impose anything.

Jean, for you example, the List.iter line using the st= andard library would be:

=A0 =A0 List.= iter (fun x -> sum :=3D !sum + x) list;

This kind of confusion is certainly not good for learning a language though= ! To resolve this, we need to clone a single person three times and send ea= ch into an alternate future: one continuing with standard library as-is, on= e with Core, and one with Batteries. Then bring them back so they can argue= amongst each other about what was better. :)


On Sat,= Nov 9, 2013 at 10:57 AM, Jean Saint-Remy <jeansaintremy@yahoo.com> wrote:
Hi,

I've been = working out some of the examples in the https://realworldocaml.= org/v1/en/html/a-guided-tour.html, which does utilize JaneStreet 'c= ore' library. The new ocaml website is very impressive, as it allows yo= u to dive right in into very fascinating idiomatic ocaml expressions. Just = launching ocaml toplevel though is not enough.=A0

let sum list =3D
=A0 let sum=A0 =3D ref 0 in
=A0 List.i= ter list ~f:(fun x -> sum :=3D !sum + x);
=A0 !su= m ;;
-: Error: The function applied to this argument has type 'a = list -> unit
=A0=A0 This argume= nt cannot be applied with label ~f

Jean

=
On Saturday, November 9, 2013 5:07= AM, Gabriel Kerneis <gabriel@kerneis.info> wrote:
On Fri= , Nov 08, 2013 at 07:33:35PM -0800, Jean Saint-Remy wrote:
> I am running ocaml 3.12.1 and getting an error message. Is it an incom= patible
> version error or a missing 'core' mo= dule?

Since you mention 'core'= , are you learning OCaml with "Real-World OCaml" (and
hence trying to use JaneStreet's Core library instead of the standard one)?
That would explain the discrepancy you are seeing.


Best,

--
G= abriel

--
Caml-list mailing list.=A0 Subscri= ption management and archives:
https://sympa= .inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_be= ginners
Bug reports: http://caml.inria.fr/bin/ca= ml-bugs



=

--047d7b6250a42bcd8a04eac2d0f6--