From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id B09BDBB91 for ; Sun, 26 Dec 2004 02:59:04 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBQ1x37Q027494 for ; Sun, 26 Dec 2004 02:59:03 +0100 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 CAA31958 for ; Sun, 26 Dec 2004 02:59:03 +0100 (MET) From: briand@aracnet.com Received: from jade.spiritone.com (jade.aracnet.com [216.99.193.136]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBQ1x0Rj027489 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 26 Dec 2004 02:59:03 +0100 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 iBQ1wxMD003246; Sat, 25 Dec 2004 17:58:59 -0800 Received: from briand by soggy.deldotd.com with local (Exim 3.36 #1 (Debian)) id 1CiNgR-00079m-00; Sat, 25 Dec 2004 17:58:59 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16846.6882.973973.179486@soggy.deldotd.com> Date: Sat, 25 Dec 2004 17:58:58 -0800 To: romildo@uber.com.br Cc: caml-list@inria.fr Subject: [Caml-list] Checking for eof In-Reply-To: <20041226011212.GA10516@gentoo.malaquias.no-ip.org> References: <20041226011212.GA10516@gentoo.malaquias.no-ip.org> X-Mailer: VM 6.92 under Emacs 21.3.1 X-Miltered: at nez-perce with ID 41CE1AE7.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41CE1AE4.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 stack:01 rec:01 exception:01 checking:01 brian:03 let:03 let:03 eof:04 eof:04 chan:05 chan:05 nicely:07 file:08 actually:10 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.2 required=5.0 tests=FORGED_RCVD_HELO,NO_REAL_NAME autolearn=disabled version=3.0.0 X-Spam-Level: Youa are actually looking for an eof exception. Here is a code segment which demonstrates this nicely and won't blow up the stack. 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 [] ;; Brian