[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
read-from-string
- To: info-mcl-digest@digitool.com
- Subject: read-from-string
- From: balls@medcolpa.edu
- Date: Wed, 17 May 1995 11:10:35 -0400
- Sender: owner-info-mcl@digitool.com
In an attempt to read a list of items from a flat file database
so that I may create objects for storage in WOOD, I need to read
items from a string of the general form:
"item1; item2; item3;
item4."
to yield -> (item1 item2 item3 item4)
The period "." allegedly always defines the end.
I wrote the following:
(let ((str "item1; item2; item3;
item4.")
(i 0)
(result nil))
(loop
(multiple-value-bind
(s j)
(read-from-string str nil 'done :start i)
(cond ((eq s 'done) (return (reverse result)))
((string/= (string-right-trim '(#\.) s) s)
(push (intern (string-upcase
(string-right-trim '(#\.) s)))
result)
(return (reverse result)))
(t
(push s result)
(setf i (+ j 1)))))))
but in the recent discussions of read-from-string, big hammers
& so forth, is their an obviously more efficient way of
accomplishing this? The file I am reading is 77 MB is size.
Thanks, Sheldon
Sheldon S. Ball
BALLS@ccc.medcolpa.edu