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

Re: String to List coerceing

... On 3 Sep 93, P2043742 (whoever that is) said:
} I have a seemingly trivial question I do not know the answere for.

} I'd like to read a line from a file and coerce it to list.
} Say, I have a file with a line:

} 100 1.3 4.2 5.8

} I'd like the line to be converted to (100 1.3 4.2 5.8) when I read it in.

} What is the simplest way to do it?

} Thanks for your help in addvance.

;;;I'll ignore the question of detecting the end-of-file.

;;;If you know how many numbers are on each line:
(DEFUN Read-Into-List (filestream length)
  (LOOP repeat length collect (READ filestream)))
;;; ... it's pretty easy to do this without the LOOP macro, too.

;;;If you don't: 
(DEFUN Readline-Into-List (filestream)

These opinions are shareware.  If you like the product,
please send your $0.02 to
               David Loewenstern