Input | Output |
---|---|
(multisubst 'vanilla 'chocolate '()) | () |
(multisubst 'vanilla 'chocolate '(vanilla icecream)) | (vanilla icecream) |
(multisubst 'vanilla 'chocolate '(chocolate icecream)) | (vanilla icecream) |
(multisubst 'vanilla 'chocolate '(chocolate icecream and chocolate milkshake) | (vanilla icecream and vanilla milkshake) |
(multisubst 'vanilla 'chocolate '((chocolate) (icecream))) | error |
(multisubst 'vanilla 'chocolate 'icecream) | error |
Input | Output |
---|---|
(subst* 'vanilla 'chocolate '()) | () |
(subst* 'vanilla 'chocolate '(vanilla icecream)) | (vanilla icecream) |
(subst* 'vanilla 'chocolate '(chocolate icecream)) | (vanilla icecream) |
(subst* 'vanilla 'chocolate '(chocolate icecream and chocolate milkshake) | (vanilla icecream and vanilla milkshake) |
(subst* 'vanilla 'chocolate '((chocolate) (icecream))) | ((vanilla) (icecream)) |
(subst* 'vanilla 'chocolate 'icecream) | error |
(subst* 'orange 'banana '((banana) (split (((banana ice)) (cream (banana)))) (banana brandy))) | ((orange) (split (((orange ice)) (cream (orange)))) (orange brandy))) |
Input | Output |
---|---|
(sum '()) | 0 |
(sum '(1)) | 1 |
(sum '(1 2)) | 3 |
(sum '(1 2 3)) | 6 |
(sum '((1) (2) (3)) | error |
(sum 1 2 3) | error |
Input | Output |
---|---|
(product '()) | 1 |
(product '(1)) | 1 |
(product '(1 2)) | 2 |
(product '(1 2 3)) | 6 |
(product '(0 1 2)) | 0 |
(product '((1) (2) (3))) | error |
(product 1 2 3) | error |
Input | Output |
---|---|
((compute + 0) '(1 2 3 4)) | 10 |
((compute * 1) '(1 2 3 4)) | 24 |
Input | Output |
---|---|
((compute op id) '(s1 s2 s3 ... sk)) | Value of the function: (op s1 (op s2 (op s3 ... (op sk id)...))) |
Input | Output |
---|---|
(mylength '()) | 0 |
(mylength '(1)) | 1 |
(mylength '(1 2)) | 2 |
(mylength '(1 2 3)) | 3 |
(mylength '((1) (2) (3))) | 3 |
(mylength '((1) (2) (3 4 5))) | 3 |
(mylength 1 2 3) | error |
Input | Output |
---|---|
(myappend '() '()) | () |
(myappend '(1) '()) | (1) |
(myappend '() '(1)) | (1) |
(myappend '(1 2 3) '(4 5 6)) | (1 2 3 4 5 6) |
(myappend '(1 2 3) '((4) 5 6)) | (1 2 3 (4) 5 6) |
Input | Output |
---|---|
(mymap (lambda (n) (+ n n)) '()) | () |
(mymap (lambda (n) (+ n n)) '(1 2 3 4)) | (2 4 6 8) |
(mymap (lambda (n) (* n n)) '(1 2 3 4)) | (1 4 9 16) |
(check '(multisubst 'vanilla 'chocolate '(chocolate icecream)) '(vanilla icecream)) |
(check '(sum '(1 2 3)) 6) |
(check '(mylength '(1 2 3)) 3) |