From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA13125 for caml-redistribution@pauillac.inria.fr; Fri, 17 Mar 2000 09:09:48 +0100 (MET) Resent-Message-Id: <200003170809.JAA13125@pauillac.inria.fr> Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA30457 for ; Wed, 15 Mar 2000 20:11:11 +0100 (MET) Received: from batman.labri.u-bordeaux.fr (batman.labri.u-bordeaux.fr [147.210.8.5]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id UAA22237 for ; Wed, 15 Mar 2000 20:11:09 +0100 (MET) Received: from serveur3-1.labri.u-bordeaux.fr (vanicat@serveur3-1 [147.210.8.180]) by batman.labri.u-bordeaux.fr (8.8.7/8.8.7) with ESMTP id UAA29619 for ; Wed, 15 Mar 2000 20:12:32 +0100 (MET) Received: (from vanicat@localhost) by serveur3-1.labri.u-bordeaux.fr (8.9.3/8.8.8/Debian/GNU) id UAA25014; Wed, 15 Mar 2000 20:11:09 +0100 X-Authentication-Warning: serveur3-1.labri.u-bordeaux.fr: vanicat set sender to vanicat@labri.u-bordeaux.fr using -f Sender: remi.vanicat@labri.u-bordeaux.fr To: caml-list@inria.fr Subject: Re: Syntax for label, NEW PROPOSAL References: <39ADCF833E74D111A2D700805F1951EF180144F2@RED-MSG-06> <20000315121549A.garrigue@kurims.kyoto-u.ac.jp> <20000315145830.22463@pauillac.inria.fr> From: Remi VANICAT In-Reply-To: Pierre Weis's message of "Wed, 15 Mar 2000 14:58:30 +0100" Date: 15 Mar 2000 20:11:08 +0100 Message-ID: User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.3 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Resent-From: weis@pauillac.inria.fr Resent-Date: Fri, 17 Mar 2000 09:09:48 +0100 Resent-To: caml-redistribution@pauillac.inria.fr Pierre Weis writes: > $ ocamlpedantic > Objective Caml version 2.99+10 >=20 > # let sum l =3D List.fold_right ( + ) l 0;; > ^^^^^ > This expression has type int -> int -> int but is here used with type= 'a list >=20 > Clearly, there is something wrong now! We may remark that the error > message is not that clear, but this is a minor point, since error > messages are never clear enough anyway! >=20 > The real problem is that fixing the code makes no good at all to its > readability (at least that's what I would say): >=20 > # let sum l =3D List.fold_right fun:begin fun x acc:y -> x + y end ac= c:0;; > val sum : 'a -> int list -> int =3D here, i prefer to use parenthesis as : let sum l =3D List.fold_right fun:(fun x acc:y -> x + y) acc:0;; it's more readable also i do want the fun: label (you may change the name, but a label here is useful) to be able to write=20 let sum l =3D List.fold_right acc:0 fun:(fun long multi line function definition here) but i agreed that the acc label (in fun x acc:y -> x + y) is a pain, because he forbid the use of usual function here=20 --=20 R=E9mi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat