From: Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp>
To: oliver@fritz.traverse.com, caml-list@pauillac.inria.fr
Subject: Re: OLabl bug?
Date: Tue, 28 Jul 1998 11:16:17 +0900 [thread overview]
Message-ID: <19980728111617B.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: Your message of "Mon, 27 Jul 1998 15:06:50 -0400 (EDT)" <E0z0sbi-0000E2-00@fritz.traverse.net>
> I had originally sent this to the CAML mailing list, but I think, in
> restrospect, this should have been sent to you.
>
> While goofing around with bignums, I entered the following program
> for computing a crude bound on the van der Waerden number for length
> 3 and partition 3.
>
> open Num
> open Nat
> open Big_int
> open Ratio
>
> let rec n k l =
> let rec m i =
> if i =/ Int 0 then
> Int 1 else
> Int 2
> */ (m (pred_num i))
> */ (n (k **/ (m (pred_num i))) (pred_num l)) in
> if l =/ Int 2 then succ_num k else m k
> in
> print_string (string_of_num (n (Int 3) (Int 3)));;
>
> Pierre Weis tells me this is legal OCAML, but OLABL complains about
> a syntax error at the second in. What can you tell me?
He is slightly wrong: your program as such will raise a syntax error
in ocaml also. He took me some time to find it, because I was always
pasting your input in two times: first the open statements, and then
the let in, and if you do that there is no error.
This is not an olabl bug, neither really an ocaml one.
The problem is that you are mixing two syntaxes: the one with
terminator (;;), and the one without (nothing after open).
Normally the first syntax is to be used at toplevel, and the second in
files, but there are hacks in the parser to allow a certain level
of mixing, which is confusing, I must admit.
Seeing a let immediatly after an open declaration, the parser is
waiting for a definitional let, and not a let in. So it throws you
when the pairing "in" comes.
Two solutions: either you add a terminator between the open sequence
and the let, or you add a dummy toplevel let:
let _ =
let ... in ...
(The second one is the only possibility when writing compiled modules)
Cheers,
Jacques
parent reply other threads:[~1998-07-28 16:41 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <E0z0sbi-0000E2-00@fritz.traverse.net>]
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=19980728111617B.garrigue@kurims.kyoto-u.ac.jp \
--to=garrigue@kurims.kyoto-u.ac.jp \
--cc=caml-list@pauillac.inria.fr \
--cc=oliver@fritz.traverse.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