As an adolescent I aspired to lasting fame, I craved factual certainty, and I thirsted for a meaningful vision of human life - so I became a scientist. This is like becoming an archbishop so you can meet girls.- Matt Cartmill
what you type | what Scheme prints | ||||||||
---|---|---|---|---|---|---|---|---|---|
`((+ 1 2) ,(+ 1 2) 4)
((+ 1 2) 3 4)
| (cons '(a b) '(c (d) e))
| ((a b) c (d) e)
| (append '((a b) (c d)) '(e f))
| ((a b) (c d) e f)
| (car ''a)
| quote
| (if 1 2 3)
| 2
| |
(rev-noah '(a b c) (d e f)) ; ((c f) (b e) (a d)) (rev-noah '() '()) ; ()Your definition should work (7 points) and be tail recursive (3 points).
(define (rev-noah lis1 lis2) (aux lis1 lis2 '())) (define (aux lis1 lis2 res) (if (null? lis1) res (aux (cdr lis1) (cdr lis2) `((,(car lis1) ,(car lis2)) ,@rev))))