This class will be recorded! Its use is limited to members of the class. Please do not share with others.
Approximate overview
Events
I’m not sure if all of these links are correct. Let me know if any are not.
Sam will gather questions, group them, and then try to answer them.
Can we go over the mental model problem?
cons or with list.(cons "a"
(cons (cons (cons (cons null
"b")
null)
(cons null
(cons (cons "c" "d")
null)))
(cons "e"
(cons "f"
null))))
Can we go over the randomness problem?
It may be helpful to use some of the randomness helpers we had already.a
;;; Procedure:
;;; random-elt
;;; Parameters:
;;; lst, a non-empty list
;;; Purpose:
;;; Unpredictably pick an element of lst.
;;; Produces:
;;; val, a value
;;; Preconditions:
;;; [No additional]
;;; Postconditions:
;;; * val is an element of lst.
;;; * If lst contains more than one element, it is difficult to predict
;;; which element val is.
(define random-elt
(lambda (lst)
(list-ref lst (random (length lst)))))
And what we did there seems relevant: A random this, then a random that, then a random other thing.
``` (define vowels (list “A” “E” “I” “O” “U”)) (define consonants (list “B” “C” “D” “F” “G” “H” “J” “K” “L” “M” “N” “P” “Q” “R” “S” “T” “V” “W” “X” “Y” “Z”)) (define random-id (lambda () (string-append (random-elt consonants) (random-elt vowels) (random-elt consonants) (random-elt vowels) (random-elt consonants) (random-elt vowels))))