> (split (list 1 2 3 4 5 6 7 8 9 0)) ; input may have even length ---> ((1 3 5 7 9) (2 4 6 8 0)) > (split (list 1 2 3)) ; input may have odd length ---> ((1 3) (2)) > (split (list 1)) ; input may be short ---> ((1) ()) > (split '() ) ; input may be very short ---> (() ()) > (split (list "a" 1 "b" 77 (* 2 4) "c" '(1 2))) ; it doesn't matter what's in the list ---> (("a" "b" 8 (1 2)) (1 77 "c"))
(define (tree->list T) (if (empty-tree? T) '() (join-em (tree->list (left-branch T)) (cons (node-value T) (tree->list (right-branch T)) )) ))
Pairs: car cdr / cons / pair? null?
Uses of pairs abstraction barriers - levels from basic scheme up to application functions
Sequences (lists): nth length / list append reverse / list?
Symbols and quote '
Symbolic differentition: Expressions are naturally processed using tree recursion.
Simplification is an issue that Make-sum, etc can handle.
(p>
rational numbers:
interval arithmetic:
(p>
List processing:
(map f L) (filter p? L) (repeater n) (multilist n)
(p>
More list processing:
(flatten L) (extent L)
(p>
Painters: segments->painter,
Painter ops: transform-painter,
specific transforms: flip-vert, rotate90, erase, etc.
binary ops: beside, below,
painter-op ops: square-of-four,
recursive ops: right-split, corner-split, up-split, square-limit,
Frames: constructors and selectors
Painter system ops: draw-line, show.
Multiple representations Manifest type Data directed programming
Some good exercises from chapter 2: 2.18, 2.21, 2.22, 2.23, 2.24