Browse thread
'a Set?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2005-01-26 (12:04) |
From: | Jacques Garrigue <garrigue@m...> |
Subject: | Re: [Caml-list] 'a Set? |
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