Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!hall From: hall@aplcen.apl.jhu.edu (Marty Hall) Newsgroups: comp.lang.lisp Subject: Re: read-from-string problem Keywords: read-from-string, keyword arguments Message-ID: <1990Dec20.160445.2237@aplcen.apl.jhu.edu> Date: 20 Dec 90 16:04:45 GMT References: <1990Dec20.115130.20493@cs.nott.ac.uk> Reply-To: hall@aplcen (Marty Hall) Organization: AAI Corp AI Lab, JHU P/T CS Faculty Lines: 31 In article <1990Dec20.115130.20493@cs.nott.ac.uk> nigel@psyc.nott.ac.uk (Nigel Major) writes: [...] >In an effort to use read-from-string, I came across what >seemed to me to be pretty odd behaviour. At first I thought >it was a bug in my Common Lisp (Lucid 3.0 on a Sun 4/110), but >the same thing happens in AKCL and Poplog CL, so I guess it >is not. Would anyone like to explain it to me? > >> (read-from-string "abcdefgh" :start 2 :end 3) >abc >3 >> (read-from-string "abcdefgh" :end 3 :start 2) >cdefgh >8 [...] I believe you are overlooking the fact that there are two optional arguments after the string and before the keywords. So your first two arguments after "abcdefgh" are taken as the values of eof-error-p and eof-value, respectively. > (read-from-string "abcdefgh" nil 'done :start 2 :end 3) C 3 (and identically if you switch the order of the keyword args) - Marty Hall ------------------------------------------------------ hall@aplcen.apl.jhu.edu, hall%aplcen@jhunix.bitnet, ..uunet!aplcen!hall Artificial Intelligence Lab, AAI Corp, PO Box 126, Hunt Valley, MD 21030