gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Re: What's wrong with gcl-2.6.6 ?


From: Camm Maguire
Subject: [Gcl-devel] Re: What's wrong with gcl-2.6.6 ?
Date: 26 Oct 2005 10:08:07 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

The following message is a courtesy copy of an article
that has been posted to comp.lang.lisp as well.

Greetings, and thanks for this report!

You've found a bug in our reader apparently.  The newline following
the invocation of (prompt-for-cd) is not read from the stream when
'(prompt-for-cd) is read, and is hence left on the stream for reading
when prompt-for-cd is evaluated.  

Its an easy fix provided one knows what the right thing to do is.
Should readers always swallow trailing whitespace when invoked at
top-level and without being invoked via read-preserving-whitespace?

If you want to test more of this, just add a (read-line) before the
(make-cd ...) in the prompt-for-cd function definition for now.

Take care,

address@hidden writes:

> The follwoing codes are from "Practical Common Lisp" :
> (defvar *db* nil)
> 
> (defun make-cd (title artist rating ripped)
> (list :title title :artist artist :rating rating :ripped ripped))
> 
> (defun add-record (cd) (push cd *db*))
> 
> (defun dump-db ()
> (format t "~{~{~a:~10t~a~%~}~%~}" *db*))
> 
> (defun prompt-read (prompt)
> (format *query-io* "~a: " prompt)
> (force-output *query-io*)
> (read-line *query-io*))
> 
> (defun prompt-for-cd ()
> (make-cd
> (prompt-read "Title")
> (prompt-read "Artist")
> (or (parse-integer (prompt-read "Rating") :junk-allowed t) 0)
> (y-or-n-p "Ripped [y/n]: ")))
> 
> under gcl-2.6.6 , the function call of (prompt-for-cd) gets the
> following responses:
> dbl:>>
> (prompt-for-cd)
> Title: Artist: 1 2
> ^^^^^^^^^^^^^
> Rating: 3
> 
> Ripped [y/n]: (Y or N) y
> 
> (:TITLE "" :ARTIST "1 2" :R  ...
> 
> The words "Title:" and  "Artist:" appear in the same line ,
> that's an obvious error.
>    The same lisp codes run on CLISP-2.34 and return as below:
> [7]> (prompt-for-cd)
> Title: 1
> Artist: 2
> Rating: 3
> Ripped [y/n]: (y/n) 4
> Please answer with y or n : y
> (:TITLE "1" :ARTIST "2" :RATING 3 :RIPPED T)
> 
> Can anyone tell me what error is in GNU common lisp ?
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]