Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!uunet!mcsun!ukc!warwick!nott-cs!clan.nott.ac.uk!lpznigel From: lpznigel@clan.nott.ac.uk (Nigel Major) Newsgroups: comp.lang.lisp Subject: read-from-string problem Summary: keyword behaviour with read-from-string is unusual Keywords: read-from-string, keyword arguments Message-ID: <1990Dec20.115130.20493@cs.nott.ac.uk> Date: 20 Dec 90 11:51:30 GMT Sender: news@cs.nott.ac.uk Reply-To: nigel@psyc.nott.ac.uk (Nigel Major) Followup-To: comp.lang.lisp Organization: AI Group, Dept. of Psychology, University of Nottingham Lines: 28 Hello there, 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 had rather assumed that the first call should return cd, and that whatever the first call had returned, the second call should return the same. CLtL says of read-from-string that the keywords :start and :end delimit a substring in the same way as for other string functions. However, > (string= "abc" "xbc" :end2 2 :start1 1 :start2 1 :end1 2) t which seems to notice the start keywords and also not worry about the order of the keywords. Cheers, Nigel.