Held Wednesday, November 6, 2002
Today we consider how to make Scheme read values and characters from files and write values to other files.
pause for breath.
(mapfuns list-of-funs val), that builds a list of values by successively applying each function in list-of-funs to val. For example,
> (mapfuns (list (left-section * 4) (right-section - 2)) 5) (20 3)
anythingyou can do on the computer.
(write value port)
(display value port)
(let* (; Prepare to read from a file (source (open-input-file "data")) ; Read one value (value (read source))) ; We're done, so clean up. (close-input-port source) ; Return the value read value)
readdo when there's nothing left in the file? It returns a special value (which DrScheme displays as
read-charencounters the end of the file, it returns the same special value as
Thursday, 29 August 2002 [Samuel A. Rebelsky]
Wednesday, 6 November 2002 [Samuel A. Rebelsky]
I usually create these pages
on the fly, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Mon Dec 2 08:41:45 2002.
The source to the document was last modified on Wed Nov 6 08:24:27 2002.
This document may be found at