Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Christopher Oliver" <oliver@fritz.traverse.com>
To: Pierre.Weis@inria.fr (Pierre Weis)
Subject: Re: Let rec trouble
Date: Tue, 28 Jul 1998 02:15:14 -0400 (EDT)	[thread overview]
Message-ID: <E0z132Z-000073-00@fritz.traverse.net> (raw)
In-Reply-To: <199807280014.CAA01029@pauillac.inria.fr> from "Pierre Weis" at Jul 28, 98 02:14:29 am

> > Um... I'm getting "syntax error" with OLABL 1.07.
> 
> Not in O'Caml :)

Jacques Garrigue found the problem, and it likely applies to OCAML
as well.  I didn't terminate my open directives with a semicolon.
He say the compiler was expecting a top level definition rather than
a lambda binding because of this.  This version compiles just fine:

  open Num
  open Nat
  open Big_int
  open Ratio;;  (* Note the trailing statement delimiter. *)
  
  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)));;

Given that some of the system sources conspicuously omit the double
semicolons, maybe it would be good to document where this is permitted
and why, else people studying the compiler as example code will get
very confused.

Small question: is there any chance your CAML books will be available
in an English translation in the future?  While I can work my way
through something like "Miroir du Cyclism" with difficulty, my French
is hardly up to technical reading.  Also, I'd like something I can
recommend to colleagues who may have no exposure to French whatsoever.

Thank you,

-- 
Christopher Oliver                     Traverse Internet
Systems Coordinator                    223 Grandview Pkwy, Suite 108
oliver@traverse.net                    Traverse City, Michigan, 49684
let magic f = fun x -> x and more_magic n f = fun x -> f ((n f) x);;




       reply	other threads:[~1998-07-28 16:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <199807280014.CAA01029@pauillac.inria.fr>
1998-07-28  6:15 ` Christopher Oliver [this message]
1998-07-25 19:06 Christopher Oliver
1998-07-27 18:30 ` Pierre Weis

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=E0z132Z-000073-00@fritz.traverse.net \
    --to=oliver@fritz.traverse.com \
    --cc=Pierre.Weis@inria.fr \
    /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