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

ascii to float--more info



I received a request fvor more of my code to support my request for a faster
way to parse floats from a text file in MCL.  

As I mentioned in my original post, the routine I'm seeking to replace is:

(defun parse-float (s)
  (read s))

This is slow (among other reasons) because it allocates 150 bytes or so
of memory for each float read.

The argument s is a stream.

Here is a routine which calls the above routine

(defun parse-real-values (npts nvars s)
  (let ((array (make-array (list npts nvars) :element-type 'float)))
    (dotimes (i npts)
      (parse-float s)             ;ignore index in file before first value
      (dotimes (j nvars)
        (setf (aref array i j) (parse-float s))))
    array))

This returns an array of real values.

Thanks for any help.

BTW I thought this list was echoed to comp.lang.lisp.mcl.  Is that the 
case?

Thanks,
--Steve

Stephen C. Gilardi
SQ Software
squeegee@world.std.com