From: Ken Anderson
Subject: Re: EOF condition in (read) from file
Date: 
Message-ID: <KANDERSO.94Feb10094555@wheaton.bbn.com>
In article <················@Isis.msstate.edu> ···@msstate.edu (Nadesan Narenthiran (naren)) writes:

   Path: news.bbn.com!uhog.mit.edu!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!spool.mu.edu!olivea!nntp.msstate.edu!nntp.msstate.edu!nn1
   From: ···@msstate.edu (Nadesan Narenthiran (naren))
   Newsgroups: comp.lang.lisp,comp.lang.lisp.x
   Date: 7 Feb 94 19:12:32
   Organization: Mississippi State University
   Lines: 26
   Distribution: usa
   Xref: news.bbn.com comp.lang.lisp:11886 comp.lang.lisp.x:1161


   Hello,
	  I am running lucid lisp on a sun machine and the following code
   does not detect the EOF condition.  Can anybody tell me why ?

   (setq temp (read in t 'EOF))
   (if (equal temp 'EOF

   or the code

   (setq temp (read in 'EOF))
   (if (equal temp 'EOF)

   I am reading the values from an ascii file but I get struck at the end
   of the file.  The second version worked in xlisp some time back, but I
   could not use xlisp as I wanted to use the (file-position in :start) and
    (random 0.2 state) functions.

     I could not find anything about this in the FAQs.  Please reply to

Try using read with the second argument (eof-error-p) being nil.

> ;;; Arglist read
(&OPTIONAL (STREAM *STANDARD-INPUT*) (CLIM-LISP::EOF-ERROR-P T)
 (CLIM-LISP::EOF-VALUE NIL) (CLIM-LISP::RECURSIVE-P NIL))

So, the following should work:

(setq temp (read in nil 'eof))
(if (eq temp 'eof) ...)
--
Ken Anderson 
Internet: ·········@bbn.com
BBN STC              Work Phone: 617-873-3160
10 Moulton St.       Home Phone: 617-643-0157
Mail Stop 6/4c              FAX: 617-873-3776
Cambridge MA 02138
USA