caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: radugrigore@gmail.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] 'a Set?
Date: Wed, 26 Jan 2005 21:04:00 +0900 (JST)	[thread overview]
Message-ID: <20050126.210400.42882977.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <7f8e92aa05012603042437cf1c@mail.gmail.com>

From: Radu Grigore <radugrigore@gmail.com>

> On Wed, 26 Jan 2005 11:13:58 +0100, Frédéric Gava
> <frederic.gava@wanadoo.fr> 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


  reply	other threads:[~2005-01-26 12:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-25 23:54 Mike Hamburg
2005-01-26  8:25 ` [Caml-list] " Jean-Christophe Filliatre
2005-01-26 10:13   ` Frédéric Gava
2005-01-26 11:04     ` Radu Grigore
2005-01-26 12:04       ` Jacques Garrigue [this message]
2005-01-26 16:00         ` Alex Baretta
2005-01-26 16:14           ` Jacques Carette
2005-01-26 21:09           ` Mike Hamburg
2005-01-29  9:55         ` Radu Grigore
2005-01-26  9:13 ` Jon Harrop
2005-01-26 15:36   ` Frédéric Gava
2005-01-26 16:06     ` Jon Harrop

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=20050126.210400.42882977.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=radugrigore@gmail.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).