Functional Problem Solving (CSC 151 2016S) : EBoards

CSC151.02 2016S, Class 20: Collage - Copy and Paste


Overview

Preliminaries

Admin

Reminders

Upcoming Work:

Extra Credit

Academic / Artistic

Peer

Regular Peer

Misc

Far in the Future

No Extra Credit, But Still Good

Questions

Can you clarify the difference between test-case and test-suite.

Both groups tests/checks together.

test-suites are delayed; only run when you say run-tests

test-cases, unless nested in test-suites, run immediately

Irrelevant for today's quiz

Is cond just like if but with extra brackets?

cond does more tests!

> (define classify
    (lambda (number)
      (if (< number 60)
          'f
          (if (< number 70)
              'd
              (if (< number 80)
                  'c
                  'b)))))
> (classify 85)
'b
> (define classify
    (lambda (number)
      (cond
        [(< number 60)
         'f]
        [(< number 70)
         'd]
        [(< number 80)
         'c]
        [else
         'impossible])))

Why do I get #f for (and (= 2 3) (/ 3 0)) but an error if I write (and (= 2 2) (/ 3 0)).

and evaluates each expression in turn. If the expression is false, and returns immediately. Otherwise, and moves on to the next expression. If any of the expressions it hits gives an error, and gives an error.

Quiz

Lab

No writeup today!