English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] two lacks of precision in the OCaml documentation
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-03-01 (12:38)
From: jeanmarc.eber@l...
Subject: [Caml-list] two lacks of precision in the OCaml documentation
0. Firstly thanks to all the OCaml team for the comming 3.01 version.
Especially the enhanced pattern-matcher will allow to express much more
elegantly some algorithms.

1. Syntax of pattern-matching

The question of whether a first vertical bar ("|") is necessary before even
the *first* pattern of a "multiple" pattern-matching is an old one on this
list. I'm personnaly in favour of this solution, but know that many others,
including some Inria OCaml team members, don't agree about that.
The situation today is that the first "bar" is optionnal. I think that this
should at least be documented correctly.
As of today (OCaml 3.00), the syntax diagram in the documentation (page 98)
don't include this optionnal bar ("pattern-matching"). Shoudn't it ?

2. Semantics of streams

In module [Stream], you "get" some stream builders. One of them enables you
to build streams from a "generator" function:

val from : (int -> 'a option) -> 'a t;;
        (* [Stream.from f] returns a stream built from the function [f].
           To create a new stream element, the function [f] is called with
           the current stream count. The user function [f] must return either
           [Some <value>] for a value or [None] to specify the end of the
           stream. *)

It is not specified (as I think, after a quick inspection of stream.ml, but I
may be wrong), that the argument [from] will only be called *once* for each
"element" (with the first argument begining with 0 and increasing each time
of course). In other words, any memoization will be done by the [stream]
implementation, and hasn't to be done by the "client" (in his [from] function).
Right ? This should be clarified, as the first argument (often useful of
course, look at a "string stream"!) could be misleading.

Jean-Marc Eber
LexiFi Technologies
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr