From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 9990BBB91 for ; Wed, 26 Jan 2005 13:04:32 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j0QC4WIj024351 for ; Wed, 26 Jan 2005 13:04:32 +0100 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 NAA03162 for ; Wed, 26 Jan 2005 13:04:31 +0100 (MET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0QC4Ti6025350 for ; Wed, 26 Jan 2005 13:04:30 +0100 Received: from localhost (suiren [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.13.1/8.13.1) with ESMTP id j0QC4O1f001258; Wed, 26 Jan 2005 21:04:24 +0900 (JST) Date: Wed, 26 Jan 2005 21:04:00 +0900 (JST) Message-Id: <20050126.210400.42882977.garrigue@math.nagoya-u.ac.jp> To: radugrigore@gmail.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] 'a Set? From: Jacques Garrigue In-Reply-To: <7f8e92aa05012603042437cf1c@mail.gmail.com> References: <16887.21524.707176.646417@gargle.gargle.HOWL> <001401c5038f$c0ad0ba0$0100a8c0@mshome.net> <7f8e92aa05012603042437cf1c@mail.gmail.com> X-Mailer: Mew version 4.1.53 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Miltered: at concorde with ID 41F78750.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41F7874D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 gava:01 gava:01 wrote:01 ocaml:01 transforming:01 semantics:01 functions:01 functions:01 jacques:01 jacques:01 parameter:02 parameter:02 seems:03 string:03 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: From: Radu Grigore > On Wed, 26 Jan 2005 11:13:58 +0100, Fr=E9d=E9ric Gava > wrote: > > When I teach Ocaml, many students are lost with > > this differences. > = > What puzzeled my is that List/String methods take the structure on > which they act as the first parameter while the Set/Map methods take > the structure on which they act as their last parameter. Is there a > reason? There seems to be an habit of having side-effecting functions take their "object" as first parameter, while side-effect-free functions take them as last. One reason is that it is natural to specialize side-effecting function on their "object", as it doesn't change (only its contents do), while effect-free functions are best seen as transforming their object (which should be last). If you respect this convention, the type tells you about the semantics :-) Jacques Garrigue