2 minutes, 13 seconds | Lecture 4 - slide 4 : 34 Program 1 |
1> (define hair-colors (pair-up '(ib per ann) '("black" "green" "pink"))) 2> hair-colors ((ib . "black") (per . "green") (ann . "pink")) 3> (find-in-list (lambda (ass) (eq? (car ass) 'per)) hair-colors) (per . "green") 4> (find-in-list (lambda (ass) (equal? (cdr ass) "pink")) hair-colors) (ann . "pink") 5> (find-in-list (lambda (ass) (equal? (cdr ass) "yellow")) hair-colors) #f 6> (let ((pink-person (find-in-list (lambda (ass) (equal? (cdr ass) "pink")) hair-colors))) (if pink-person (car pink-person) #f)) ann