(port-map FN THUNK) where does the port go?
I was sort of hoping for something like this to work: csi> (define inp (open-input-file "~/.bashrc")) csi> (define a (port-map inp read-line)) csi> (close-input-file inp) but it took guessing to figure out the intended usage. How about some trivial examples in the docs? By trial and error I figured this out: (define a (with-input-from-file "~/.bashrc" (lambda ()(port-map (lambda (x) x) read-line)))) That is ugly. I just want to get a file into a list: E.g. in Ruby: foo=`cat ~/.bashrc` port-fold doesn't improve it: (define b (with-input-from-file "~/.bashrc" (lambda ()(reverse (port-fold cons '() read-line))))) Is there an egg or unit for down-n-dirty, get-the-job-done-yesterday, screw the "right thing" programming? (use ducttape) (define a (file->list "~/.bashrc")) .... Such a unit or egg deserves mention on the front page. I dug though the docs and never did find an easy way to do what I want.
_______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
