Functional Problem Solving (CSC 151 2015S) : Outlines
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Taking Notes] [Rubric] - [Calendar]
Current: [Assignment] [EBoard am] [EBoard pm] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards am] [EBoards pm] [Labs] [Outlines] [Readings] - [Examples] [Handouts]
Reference: [Setup] [VM] [Errors] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Davis (2013F)] [Rebelsky (2014F)] [Weinman (2014F)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Book Office Hours] - [Issue Tracker (Course)]
Held: Friday, 1 May 2015
Back to Outline 50 - Merge Sort. On to Outline 52 - Project Assessment: Images.
Summary
We consider files, a technique for structuring information that permits the information to persist across invocations of Scheme. Files also let our Scheme programs share information with other programs.
Related Pages
Overview
Administrivia
We'll do an example of binary search on the animals tree. (We'll use the animals, rather than the letters.)
We'll do an example of the advanced flattening algorithm on a generated tree. Yes, you may take a photo after class. You should probably take notes, too.
(open-input-file *file-name*).(open-output-file *file-name*).(read *port*)(newline *port*)(write *value* *port*)(display *value* *port*)(close-input-port *port*)(close-output-port *port*)read do when there's nothing left in the file?
It returns a special value (which DrScheme displays as
#<eof>).eof-object?(read-char *port*).read procedure.(peek-char *port*)read-char encounters the end of the file, it returns
the same special value as read