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 DAA21296; Wed, 28 Jul 2004 03:35:59 +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 DAA21619 for ; Wed, 28 Jul 2004 03:35:58 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6S1ZuEV032100 for ; Wed, 28 Jul 2004 03:35:57 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id i6S1Zoo22376; Tue, 27 Jul 2004 20:35:51 -0500 (CDT) Date: Tue, 27 Jul 2004 20:43:48 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: briand@aracnet.com cc: John Prevost , Ocaml Mailing List Subject: Re: [Caml-list] looping recursion In-Reply-To: <16646.64470.304530.264731@soggy.deldotd.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 410702FC.001 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 extlib:01 sourceforge:01 drop-in:01 extlib:01 enum:01 java's:01 iterator:01 stack:02 wrote:03 library:03 data:03 data:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 27 Jul 2004 briand@aracnet.com wrote: > That's just not good ! I can't even use standard map without the > stack blowing up ? This is a Bad Thing (TM). Take a look at ExtLib: http://sourceforge.net/projects/ocaml-lib/ This contains a drop-in compatible replacement to the List library, which includes a List.map function that doesn't blow up. If your list is that long, I'd actually recommend doing one of two things: 1) Switch off your list data structure for a more complicated data structure, like a Set. If you do any sort of complicated access patterns, this will likely be a big win, or 2) If you only ever need to iterate through the list (and thus have simple access requirements), consider switching over to using an ExtLib style enum (same basic concept as Java's Iterator class). This allows you do "wavefront" processing- apply the map to the list items as you read them in. Very long lists are a sign that you're using the wrong data structure. -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- 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