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 A6EE97EE25 for ; Sat, 9 Nov 2013 19:42:28 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of anil@recoil.org) identity=pra; client-ip=89.16.177.154; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anil@recoil.org"; x-sender="anil@recoil.org"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of anil@recoil.org) identity=mailfrom; client-ip=89.16.177.154; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anil@recoil.org"; x-sender="anil@recoil.org"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@dark.recoil.org) identity=helo; client-ip=89.16.177.154; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anil@recoil.org"; x-sender="postmaster@dark.recoil.org"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtsBAFeBflJZELGanGdsb2JhbABZgz+rYoEykliBQg4BAQEBAQgLCQkUKIIlAQEEASdGAQsFCwsYDSFFEgYTEoddAwkKCbJyA4l1jHWCPzMHgyCBEAOJQoxogWWBL4sjiH8b X-IPAS-Result: AtsBAFeBflJZELGanGdsb2JhbABZgz+rYoEykliBQg4BAQEBAQgLCQkUKIIlAQEEASdGAQsFCwsYDSFFEgYTEoddAwkKCbJyA4l1jHWCPzMHgyCBEAOJQoxogWWBL4sjiH8b X-IronPort-AV: E=Sophos;i="4.93,668,1378850400"; d="scan'208";a="34672621" Received: from recoil.dh.bytemark.co.uk (HELO dark.recoil.org) ([89.16.177.154]) by mail3-smtp-sop.national.inria.fr with SMTP; 09 Nov 2013 19:42:27 +0100 Received: (qmail 12657 invoked by uid 634); 9 Nov 2013 18:42:27 -0000 X-Spam-Level: * X-Spam-Check-By: dark.recoil.org Received: from 99-40-5-239.lightspeed.sntcca.sbcglobal.net (HELO [172.16.42.29]) (99.40.5.239) (smtp-auth username remote@recoil.org, mechanism cram-md5) by dark.recoil.org (qpsmtpd/0.84) with ESMTPA; Sat, 09 Nov 2013 18:42:25 +0000 Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1812\)) From: Anil Madhavapeddy In-Reply-To: <1384019828.3098.YahooMailNeo@web160502.mail.bf1.yahoo.com> Date: Sat, 9 Nov 2013 10:42:21 -0800 Cc: Gabriel Kerneis , "caml-list@inria.fr" Content-Transfer-Encoding: quoted-printable Message-Id: References: <1383968015.11272.YahooMailNeo@web160505.mail.bf1.yahoo.com> <20131109100726.GA4014@kerneis.info> <1384019828.3098.YahooMailNeo@web160502.mail.bf1.yahoo.com> To: Jean Saint-Remy X-Mailer: Apple Mail (2.1812) X-Virus-Checked: Checked by ClamAV on dark.recoil.org Subject: Re: [Caml-list] applying labled argument error Dear Jean, Please do go through the installation instructions at: https://realworldocaml.org/install The Real World OCaml tutorials assume that you use the "utop" toplevel rath= er than than the standard toplevel. You also need to "open Core.Std" at th= e beginning of the toplevel to ensure that you're using the Core standard l= ibrary. So you need: $ utop # open Core Std ;; # let sum list =3D=20 let sum =3D ref 0 in=20 List.iter list ~f:(fun x -> sum :=3D !sum + x); !sum ;; val sum : int list -> int =3D =20 It's possible to use the standard OCaml toplevel if you really want to, but= you need to manually configure several settings that Utop sets by default = (short-paths, and evaluation of Async Deferred.t values at the toplevel). best, Anil On 9 Nov 2013, at 09:57, Jean Saint-Remy wrote: > Hi, >=20 > 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' lib= rary. The new ocaml website is very impressive, as it allows you to dive ri= ght in into very fascinating idiomatic ocaml expressions. Just launching oc= aml toplevel though is not enough.=20 >=20 > let sum list =3D=20 > let sum =3D ref 0 in=20 > List.iter list ~f:(fun x -> sum :=3D !sum + x); > !sum ;; > -: Error: The function applied to this argument has type 'a list -> unit > This argument cannot be applied with label ~f >=20 > Jean >=20 >=20 > On Saturday, November 9, 2013 5:07 AM, Gabriel Kerneis 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 incomp= atible > > version error or a missing 'core' module? >=20 > 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. >=20 >=20 > Best, >=20 > --=20 > Gabriel >=20 > --=20 > 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 >=20 >=20 >=20