From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA29827; Wed, 28 Jul 2004 21:43:33 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA29541 for ; Wed, 28 Jul 2004 21:43:32 +0200 (MET DST) Received: from ptb-relay02.plus.net (ptb-relay02.plus.net [212.159.14.213]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6SJhVEV018494 for ; Wed, 28 Jul 2004 21:43:32 +0200 Received: from [80.229.56.224] (helo=chetara) by ptb-relay02.plus.net with esmtp (Exim) id 1BpuKp-0000rM-Lu for caml-list@inria.fr; Wed, 28 Jul 2004 19:43:31 +0000 From: Jon Harrop To: Ocaml Subject: Re: [Caml-list] looping recursion Date: Wed, 28 Jul 2004 20:40:40 +0100 User-Agent: KMail/1.6.2 References: <16646.64470.304530.264731@soggy.deldotd.com> <4107544C.4040502@baretta.com> In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200407282040.40600.jon@jdh30.plus.com> X-Miltered: at nez-perce with ID 410801E3.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 recursion:01 2004:99 38,:01 brogoff:01 brogoff:01 000,:01 ocamlopt:01 caml-list:01 seattle:99 ocaml:01 ocaml:01 bytecode:01 int:01 native:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wednesday 28 July 2004 17:38, brogoff wrote: > > brogoff wrote: > > > Sometimes lists are best. If lists are OK for 100, 1_000, or 10_000 > > > items, why not 100_000 or 1_000_000? Map and friends shouldn't blow > > > stack. Creating an int list with 1,000,000 elements and applying List.map using ocamlopt works fine here, and took a meagre 3.6 secs. If you must use bytecode for this then just increase the stack size limit, for example to 8Mb: export OCAMLRUNPARAM='l=8M' Then it runs fine, in 10.7 secs here. Wow, that's quite fast... :-) > Well, I'm still on the caml-list, so of course it isn't *that* bad. Also, > as I said, if you need a tail recursive map over built in lists, you have > at least two options. Unfortunately, my preference is to use Obj, which IMO > points to a deficiency in the core language. No! That points to a severe deficiency in your programming style. OCaml has been developed and used by a great many very clever people, and me. If you're doing things like that then you should immediately stop and think what you might be doing wrong. Perhaps you picked the bad style up at a Seattle OCaml user group meeting? What's wrong with List.rev_map, List.rev (List.rev_map ...), increasing the size of the VM's stack, using native code or even writing your own, tail-recursive map? Cheers, Jon. ------------------- 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