[drakma-devel] [Bug Report] split-string behaves different in Lispworks and SBCL.
Jianshi Huang
jianshi.huang at gmail.com
Mon Mar 5 08:13:09 UTC 2007
I updated drakma to 0.6.0 but found the cookie could not be parsed
correctly in SBCL. So I traced down into the source code and found
it's the problem of function split-string. But in Lispworks Personal,
it works well. As the function split-string is a big extended loop
macro. So I think it might be a bug in SBCL's loop facility. I also
tested in Allegro CL and found it behaves the same as SBCL. So which
is correct?
Here's the function split-string in 0.6.0
(10defun split-string (11string &optional (separators " ,-"))
"Splits STRING into substrings separated by the characters in the
sequence SEPARATORS. Empty substrings aren't collected."
(12loop for 13char across 14string
15when (16find 17char separators :test #'18char=)
19when collector
collect (20coerce collector '21string) into result
22and 23do (24setq collector 25nil) end
else
collect 26char into collector
finally (27return (28if collector
(29append result (30list (31coerce collector
'32string)))
result))))
Here's the REPL history in Lispworks:
CL-USER 2 > (33setf x "Tue, 06-Mar-2007 00:00:00 GMT")
"Tue, 06-Mar-2007 00:00:00 GMT"
CL-USER 4 > (split-string x)
("Tue" "06" "Mar" "2007" "00:00:00" "GMT")
Here's in SBCL:
CL-USER> (34setf x "Tue, 06-Mar-2007 00:00:00 GMT")
"Tue, 06-Mar-2007 00:00:00 GMT"
CL-USER> (split-string x)
("Tue" "Tue06" "Tue06Mar" "Tue06Mar2007" "Tue06Mar200700:00:00"
"Tue06Mar200700:00:00GMT")
More information about the Drakma-devel
mailing list