Functional Problem Solving (CSC 151 2014F) : EBoards

CSC151.01 2014F, Class 17: Boolean Values and Predicate Procedures


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit Opportunities

Academic

Peer Support

Miscellaneous

Questions

Boolean values

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, lambda

New keywords introduced in this reading: and, or, not

and has a different order of evaluation. We look at each parameter one at a time, rather than evaluating them first. (Similar for or.)

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.