Some have said that I can't sing. But no one will say that I didn't sing.- Florence Foster Jenkins
printed representation | box and pointer diagram |
---|---|
(a b (c d) ()) | |
(a b (c) ((d) e f) g) |
|
expression | value |
---|---|
(cons '(a b c) '(d e f)) | |
(list '(a b c) '(d e f)) | |
(caddr '(a b (c d) e f)) | |
(map even? '(1 2 3 4)) | |
(let ((a 1)) (let ((a 2) (b (+ a 2))) (list 'a a 'b b))) |
(define (a-to-1 wd) (if (equal? wd 'a) 1 0)) (define (neato fn lst) (cond ((null? lst) 0) ((not (list? lst)) (fn lst)) (else (+ (neato fn (car lst)) (neato fn (cdr lst)))))) (define (foo expr) (neato a-to-1 expr)) |
Examples:
((curry + 3) 1) ; 4 ((curry cons 'dog) '(cat rat)) ; (dog cat rat) (let ((f (curry assoc 'blood))) (f '((hair brown)(blood red)(tongue pink)))) ; (blood red)
Example:
(replace '(a b c (a d) a) 'a 'aye) ; (aye b c (aye d) aye)
Examples:
(reshape 'a '((((1))))) ; 1 (reshape '((((a)))) '1) ; ((((1)))) (reshape '(((a (b)))) '((1) 2)) ; (((1 (2)))) (reshape '(((a (b))) (c d)) '((1) (2 (((3))) 4))) ; (((1 (2))) (3 4))