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


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;

to yield -> (item1 item2 item3 item4)

The period "." allegedly always defines the end.

I wrote the following:

(let ((str "item1; item2; item3;
      (i 0)
      (result nil))
      (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)))
             (return (reverse result)))
             (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