Browse thread
[Caml-list] strange behaviour of ocamldoc
[
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: | -- (:) |
| From: | Virgile Prevosto <prevosto@m...> |
| Subject: | Re: [Caml-list] Confused |
Le 15.09.2004, à 17:23:48, Radu Grigore a écrit:
> But it still doesn't explain why I was unable to exit ocaml
> interactive interpreter after loading camlp4r and typing your exact
> example: exit doesn't work, #quit doesn't work, ctrl-C doesn't work,
> etc. The only solution that worked was ctrl-Z followed by "kill".
>
because camlp4R loads the Revised syntax, in which toplevel sentences
are ended by a single semicolumn, not a double one:
~ [754]$ ocaml
Objective Caml version 3.08.1
# #load "camlp4r.cma";; (* normal syntax, use ';;' *)
Camlp4 Parsing version 3.08.1
# exit 0; (* revised syntax, use ';' *)
~ [755]$
To go back to the initial question, note that the revised syntax has two
different keywords for global declaration and local binding: the former
is introduced by 'value', while the latter is still 'let ... in'. Hence,
you'll have to write
# #load "camlp4r.cma";;
# value test =
let rec build =
fun [0 -> [] | n -> [1e-6 :: build (n-1)]]
in [1.::(build 1000)];
(* There are also differences in lists and pattern-matching syntax *)
value test : list float
= [1; 1e-06; 1e-06; 1e-06; 1e-06; 1e-06; 1e-06; 1e-06; 1e-06; 1e-06;
1e-06; <snip>
The revised syntax is described in the chapter 6 of the camlp4 manual.
--
E tutto per oggi, a la prossima volta
Virgile
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners