Subject: Re: Help required: Is there a way to split up one element into several?
From: Erik Naggum <>
Date: 2000/03/30
Newsgroups: comp.lang.lisp
Message-ID: <>

* Erik Halvarsson <>
| From an external file I need to get some data, and it's stored like:
| VKA100         707898.512    78172.497    143.803
| a simple xyz coordinate.  When I use the (readline file) function, that
| string becomes one single element in the list I assign it to.  What I
| need is four different elements in the list but I have so far no clue
| how to achive this.  Would be great if anyone out there could help me.

  if each line is known to consist of these four elements, the first looks
  very much a symbol, and programmer time is more important than much
  anything else, just use the function read.  here's a quick shot at it:

(let ((*package* (make-package (gensym) :use ())))
      (loop for line = (loop with first = (read <stream> nil)
			     if (not first)
			     then do (loop-finish)
			     else collect (symbol-name first)
			     repeat 3
			     collect (read <stream>))
	    while line
	    collect line)
    (delete-package *package*)))