Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 28 |
Nodes: | 6 (1 / 5) |
Uptime: | 45:56:59 |
Calls: | 422 |
Calls today: | 1 |
Files: | 1,024 |
Messages: | 90,336 |
In Scheme I would probably do something like (list->vector (reverse
dict)) but is there a way to build the vector directly without knowing
the size in advance? Or is there a more "CL" way to do this?
What about this:
(with-open-file (str filename :direction :input)
(loop for line = (read-line str nil 'eof)
until (eql line 'eof)
collect line into dict
finally (return (apply #'vector dict))))
or:
(with-open-file (str filename :direction :input)
(loop for line = (read-line str nil 'eof)
until (eql line 'eof)
count t into line-count
collect line into dict
finally (return
(make-array line-count :initial-contents dict))))