home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sdd.hp.com!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!squeegee@world.std.com
- From: squeegee@world.std.com (Stephen C. Gilardi)
- Newsgroups: comp.lang.lisp.mcl
- Subject: ascii to float--more info
- Message-ID: <199211052350.AA17952@world.std.com>
- Date: 5 Nov 92 23:50:46 GMT
- Sender: info-mcl-request@cambridge.apple.com
- Lines: 36
- Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
- Original-To: info-mcl@cambridge.apple.com
-
- 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
-