[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: String to List coerceing
- To: email@example.com
- Subject: Re: String to List coerceing
- From: firstname.lastname@example.org (David Loewenstern)
- Date: Fri, 3 Sep 93 01:56:03 EDT
- Cc: P2043742@csdvax.csd.unsw.edu.au
- In-reply-to: <01H2IJAD0HS291X4LN@csdvax.csd.unsw.EDU.AU> "P2043742@csdvax.csd.unsw.edu.au"
- Reply-to: email@example.com (David Loewenstern)
... 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)
(READ-FROM-STRING (CONCATENATE 'STRING "(" (READ-LINE filestream) ")")))
These opinions are shareware. If you like the product,
please send your $0.02 to