Hi, I need to read a file (lines of numbers) into a list of lists with each line a list. I wrote the following function to do it:
(define (read-all-lines file-name) (let ([output '()]) (let ([p (open-input-file file-name)]) (let f ([x (read-line p)]) (if (eof-object? x) (close-input-port p) (begin (set! output (cons (string-split x) output)) (f (read-line p)))))) (reverse output))) I have a few questions regarding the above code: 1. Is there an existing API to do the same thing? 2. Using set! seems not a lispy coding style. Is it true? 3. Any improvements I can make ? I bet there are tons. Thank you! Jinsong
_______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users