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 DAA19339; Wed, 28 Jul 2004 03:05:37 +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 DAA19710 for ; Wed, 28 Jul 2004 03:05:35 +0200 (MET DST) From: briand@aracnet.com Received: from jade.spiritone.com (jade.spiritone.com [216.99.193.136]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6S15XEV029181 for ; Wed, 28 Jul 2004 03:05:34 +0200 Received: from soggy.deldotd.com (216-99-206-32.cust.aracnet.com [216.99.206.32]) by jade.spiritone.com (8.12.8/8.12.8) with ESMTP id i6S15Q2v019478; Tue, 27 Jul 2004 18:05:26 -0700 Received: from briand by soggy.deldotd.com with local (Exim 3.36 #1 (Debian)) id 1Bpcso-0000OJ-00; Tue, 27 Jul 2004 18:05:26 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16646.64470.304530.264731@soggy.deldotd.com> Date: Tue, 27 Jul 2004 18:05:26 -0700 To: John Prevost Cc: Ocaml Mailing List Subject: Re: [Caml-list] looping recursion In-Reply-To: References: <16646.59534.101085.662305@soggy.deldotd.com> X-Mailer: VM 6.92 under Emacs 21.2.1 X-Miltered: at nez-perce with ID 4106FBDD.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 rec:01 eof:02 eof:02 stack:02 string:03 data:03 data:03 sufficient:04 let:04 let:04 bold:93 brian:06 loop:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk After sufficient googling I finally found a post which yields the answer : let readfile chan = let rec loop rlst = let line, eof = try (input_line chan), false with | End_of_file -> "", true in if not eof then loop (line :: rlst) else List.rev rlst in loop [] ;; but then it gets better. Imagine my surprise when the following failed: let data = readfile (open_in "data") in let split_lines = List.map (fun line -> line; ) data in print_string "Done.\n";; That's just not good ! I can't even use standard map without the stack blowing up ? This is a Bad Thing (TM). Oh but wait. I peruse the manual. map_rev is what I want. So I'm going to make a bold statement that .map which blows up shouldn't even exist and .rev_map should be renamed to .map. Naturally someone will be telling me very shortly why you can't do this... 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