Download presentation
Presentation is loading. Please wait.
1
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis colleenL@berkeley.edu Lecture 27: Review – most children and truth about cons
2
Today Generalized List Recursion The truth about cons
3
most-children (define (number-of-most-children tree) (if (leaf? tree) 0 (reduce max (cons (length (children tree)) (map number-of-most-children (children tree) ) ) ) ) )
4
most-children A CB FDD 0 0 0 3 0 0
5
The truth about cons (cons ‘B ‘() ) ‘(B) B‘() carcdr
6
The truth about cons (cons ‘A ‘(B) ) ‘(A B) A carcdr B‘() carcdr
7
The truth about cons (cons ‘A ‘(B C D) ) ‘(A B C D) A carcdr B carcdr C carcdr D‘() carcdr
8
The truth about cons (cons ‘(A) ‘(B) ) ‘((A) B) carcdr B‘() carcdr A‘() carcdr
9
The truth about cons (cons ‘A ‘B) ‘(A. B) AB carcdr
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.