Functional Problem Solving (CSC 151 2015F) : EBoards

CSC151.01 2015F, Class 36: Randomized (Unpredictable) Drawing


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit Opportunities

Academic

Peer Support

Regular Peer Support

Upcoming Peer Support

Questions

Can we look at any and all?

> (all odd? (list 1 3 11 23))
#t
> (all odd? (iota 5))
#f
> (any odd? (iota 5))
#t
> (any odd? (list 'sam 'erin 'zachary))
. . lib/gigls/higher.rkt:44:13: odd?: contract violation
  expected: integer
    given: 'sam
> (all odd? null)
#t
> (any odd? null)
#f
> (all even? null)
#t
> (all weird? null)
. . weird?: undefined;
cannot reference an identifier before its definition

Lab

For the pair-a-dice problem, you may find it helpful to write

    (define tally-seven-eleven
      (lambda (n)
        (display (list "tallying" n "more dice")) (newline)
        ...))

Writeup is 3d or 4a