Petite Chez Scheme Version 9.5 Copyright 1984-2017 Cisco Systems, Inc. > (+ (/ 3 5) (/ 2 7)) 31/35 > six Exception: variable six is not bound > (define six 6) > (+ six 2) 8 > (list 2 3 4) (2 3 4) > '(2 3 4) (2 3 4) > (list 2 six 4) (2 6 4) > '(2 six 4) (2 six 4) > (2 4 6) Exception: attempt to apply non-procedure 2 > + # > a Exception: variable a is not bound > (define a (list 2 3 4)) > a (2 3 4) > (car 2)(define times3 (lambda (n) (* n 3))) Exception in car: 2 is not a pair > (car a) 2 > (cdr) Exception: incorrect argument count in call (cdr) > (cdr a) (3 4) > (car (cdr a)) 3 > (cadr a) 3 > (caddr a) 4 > (cadddr a) Exception in cadddr: incorrect list structure (2 3 4) > (caddddr a) Exception: variable caddddr is not bound > (define times3 (lambda (n) (* n 3))) > (define times6 (lambda (n) (+ (times3 n) (times3 n)))) > (times6 7) 42 > (trace times6) (times6) > (trace times6 times3) (times6 times3) > (times6 7) |(times6 7) | (times3 7) | 21 | (times3 7) | 21 |42 42 > (trace *) Warning in trace: redefining *; existing references will not be traced (*) > (define times3 (lambda (n) (* n 3))) > (times6 7) |(times6 7) | (* 7 3) | 21 | (* 7 3) | 21 |42 42 > (untrace) (times6 *) > (define fact (lambda (n) (if (zero? n) 1 (* n (fact (- n 1)))))) > (fact 5) 120 > (fact 200) 788657867364790503552363213932185062295135977687173263294742533244359449963403342920304284011984623904177212138919638830257642790242637105061926624952829931113462857270763317237396988943922445621451664240254033291864131227428294853277524242407573903240321257405579568660226031904170324062351700858796178922222789623703897374720000000000000000000000000000000000000000000000000 > (trace fact) (fact) > (fact 5) |(fact 5) | (fact 4) | |(fact 3) | | (fact 2) | | |(fact 1) | | | (fact 0) | | | 1 | | |1 | | 2 | |6 | 24 |120 120 > (define nth-element (lambda (ls n) (cond [(null? ls) "error"] [(zero? n) (car ls)] [else (nth-element (cdr ls) (-n 1))]))) > (nth-element '(a b c d e f) 3) Exception: variable \x2D;n is not bound > (define nth-element (lambda (ls n) (cond [(null? ls) "error"] [(zero? n) (car ls)] [else (nth-element (cdr ls) (- n 1))]))) > (nth-element '(a b c d e f) 3) d >