caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gregory BELLIER <gregory.bellier@gmail.com>
To: Joel Christner <joel.christner@gmail.com>
Cc: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Re: Toplevel function question
Date: Thu, 14 May 2009 09:52:20 +0200	[thread overview]
Message-ID: <4A0BCDB4.10105@gmail.com> (raw)
In-Reply-To: <9da743ed0905131710w5563de39i60f1d60c071ff515@mail.gmail.com>

Hello !

Joel Christner a écrit :
> Simpler representation - tried compiling this and got the same syntax 
> error - at a line number that was after the EOF.  Thanks in advance 
> for any help!!
>
> let add_text variablelist text =
>   variablelist.contents <- text::variablelist.contents
>

Please refer to the last email from John Li.
variablelist := test :: !variablelist


> let originalprogramcontents = ref [""]
>
> let _ =
>   let lexbuf = Lexing.from_channel stdin in
>   let rec storeoriginalprogram =
>     let expr = lexbuf in
>     match expr with
>     | EOF   -> ()
>     | _     -> (add_text originalprogramcontents expr); 
> storeoriginalprogram
>   in let parseprogram = List.iter
>     (fun n -> print_string n; print_string "\n";) originalprogramcontents
Here you should call _*!*_originalprogramcontents which seems to be 
empty with your example because you declare the function 
storeoriginalprogram but you don't use/call it.

Try something like :

let myvariable = 1 in

let rec fun var =
       match var with
    | val1 -> ...
    | val2 -> ...
    | _ -> ...
in
    fun my_variable   ( <<--- this is what you forgot )

Gregory.


  parent reply	other threads:[~2009-05-14  7:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-13 23:43 Joel Christner
2009-05-14  0:10 ` Joel Christner
2009-05-14  5:25   ` RE : [Caml-list] " MONATE Benjamin 205998
2009-05-14  7:52   ` Gregory BELLIER [this message]
2009-05-14 10:23   ` Cedric Auger
2009-05-14 10:29     ` Cedric Auger

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=4A0BCDB4.10105@gmail.com \
    --to=gregory.bellier@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=joel.christner@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).