This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

re: help to get this running faster


Hello--

It's not exactly the same script, but I think it does pretty much the same 
thing (I changed from a set of nested lists (???) to a single list).

On my machine, it's an order of magnitude faster than the previous
script.

--Brad

(define-module (alto tabreader))

(export load-records)

(use-modules (ice-9 optargs))
(use-modules (ice-9 string-fun)

(define* (load-records fname #&optional (sep #\tab))
  (call-with-input-file fname
    (lambda (i-stream)
      (do ((records '())
	   (line (read-line i-stream) (read-line i-stream)))
	  ((eof-object? line) records)
	(set! records (append records (list (split-discarding-char sep line list))))))))

;; (load-records "/tmp/h")
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]