Functional Problem Solving (CSC 151 2014F) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Readings]
Reference: [Setup] [VM] [Errors] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Davis (2013F)] [Rebelsky (2014S)] [Weinman (2014F)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Issue Tracker (Course)]
Overview
What's the difference between a "keyword" and a "procedure"?
Procedures are parameterized collections of instructions. Call with
(PROCEDURE inputs)There are a number of things in Scheme that look like procedures, in that we write
(THING values). Scheme interprets these slightly differently.For a procedure:
(* (+ 1 2) (* 3 4))we always evaluate the parameters before we apply the operation.(* alpha 4)It depends on what we know about alpha. If we know nothing, we get an error. If it's not a number, we get an error.(define alpha (+ 2 3)). Something that looks like a procedure, but acts diffently. Also not (define (max ...) 5)
We need a way to name things that are like procedures, but which have a different semantics of evaluation. We call them "keywords".
Keywords that you have encountered:
define,lambdaNew keywords introduced in this reading:
and,or,not
andhas a different order of evaluation. We look at each parameter one at a time, rather than evaluating them first. (Similar foror.)
Can you explain the "beyond the truth binary" section?
yadda yadda yadda
Why would we do and with non-truth values?
Most frequent reason. I want to do THIS then THIS then THIS, but stop if any of them fail.
Can you be more detailed?
Not right now.