caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Virgile Prevosto <prevosto@mpi-sb.mpg.de>
To: Radu Grigore <radugrigore@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Confused
Date: Wed, 15 Sep 2004 16:50:46 +0200	[thread overview]
Message-ID: <20040915165046.081f6b31@mpiat2314> (raw)
In-Reply-To: <7f8e92aa04091507237e187ac5@mail.gmail.com>

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


  reply	other threads:[~2004-09-15 14:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-14 17:47 [Caml-list] strange behaviour of ocamldoc Eugene Ossintsev
2004-09-15 13:28 ` [Caml-list] Confused Jon Harrop
2004-09-15 13:46   ` Michael
2004-09-15 13:51   ` Radu Grigore
2004-09-15 14:01   ` Brian Hurt
2004-09-15 14:13   ` Jon Harrop
     [not found]     ` <7f8e92aa04091507233d074f31@mail.gmail.com>
2004-09-15 14:23       ` Radu Grigore
2004-09-15 14:50         ` Virgile Prevosto [this message]
2004-09-15 14:57           ` Radu Grigore
2004-09-15 14:52   ` skaller
2004-09-15 18:42     ` William Lovas

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=20040915165046.081f6b31@mpiat2314 \
    --to=prevosto@mpi-sb.mpg.de \
    --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).