Subject: Re: Read a line from a file, turn into a list of numbers
From: Erik Naggum <erik@naggum.net>
Date: Thu, 28 Mar 2002 16:01:46 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3226320120828579@naggum.net>

* wild_donkey@yahoo.com (David)
| I'm trying to learn lisp and am struggling a bit over doing this
| seemingly simple task. I want to read a line from a file and convert it
| into a list of numbers. So far I have only managed to convert it into a
| list of characters and can't figure out how to get a list of numbers (the
| numbers are separated by spaces in the file) from this.  Can anyone point
| me in the right function direction.

  In addition to Nils's suggestions, look into the reader variable
  *read-default-float-format* if you have floating-point numbers.  Also,
  please note that when you use the general reader, any symbol with a
  syntax error relative to the Common Lisp syntax, will be returned as a
  symbol.  It might be a good idea to set up your own readtable to exclude
  irrelevant data types, too.  Unfortunately, there is no standard way to
  avoid interning new symbols.  (I wish there were at least some way to
  control the reader's willingness to make symbols.)

///
-- 
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.