Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Max Kirillov <max630@mail.ru>
To: caml-list@inria.fr
Subject: Re: [Caml-list] let rec
Date: Thu, 16 Jan 2003 01:53:41 +0600	[thread overview]
Message-ID: <20030116015340.B653@max.home> (raw)
In-Reply-To: <Pine.LNX.4.52L.0301152209070.28020@ontil.ihep.su>; from vsl@ontil.ihep.su on Wed, Jan 15, 2003 at 10:15:48PM +0300

On Wed, Jan 15, 2003 at 10:15:48PM +0300, Vitaly Lugovsky wrote:
VL>  It's not so funny. Why I can't write it using let rec:
VL> 
VL>     let rec f (il,al,ht) =
VL>       let il2 = Array.make (n2+1) Lnil in
VL>       acopy il il2;
VL>       Array.iteri (fun i x -> il2.(all.(i)) <- x) al;
VL>       xprs (il2,anul,ht)
VL>     and xprs =
VL>       (Hashtbl.replace ht name (CTfun(f));
VL>        compile_exprs env2 exprs) in
VL>     f

You may use lazy things:

>     let rec f (il,al,ht) =
>       let il2 = Array.make (n2+1) Lnil in
>       acopy il il2;
>       Array.iteri (fun i x -> il2.(all.(i)) <- x) al;
>       (Lazy.force xprs) (il2,anul,ht)
>     and xprs =
>       lazy ((Hashtbl.replace ht name (CTfun(f));
>		compile_exprs env2 exprs)) in
>     (*optional*) ignore(Lazy.force xprs);
>     f

-- 
Max
-------------------
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


  parent reply	other threads:[~2003-01-15 20:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-15 19:15 Vitaly Lugovsky
2003-01-15 19:27 ` james woodyatt
2003-01-15 19:54   ` Vitaly Lugovsky
2003-01-15 19:53 ` Max Kirillov [this message]
2003-01-16 14:38 ` Mike Potanin
2003-01-18 12:08   ` Damien Doligez
2003-01-18 15:31     ` Mike Potanin
2003-01-18 19:22     ` Vitaly Lugovsky

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=20030116015340.B653@max.home \
    --to=max630@mail.ru \
    --cc=caml-list@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