Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 ; p6.scm
- 2 ; A prototype for program 6 in scheme
- 3 ;
- 4 ;
- 5 ;
- 6 ;
- 7 ;
- 8 ; Edit this file to add your documentation and function definitions.
- 9 ; Leave the rest of this file unchanged.
- 14 ;
- 15 ; Defined LISTS for use with testing your functions.
- 16 (DEFINE list0 (LIST 'j 'k 'l 'm 'n 'o 'j) )
- 17 (DEFINE list1 (LIST 'a 'b 'c 'd 'e 'f 'g) )
- 18 (DEFINE list2 (LIST 's 't 'u 'v 'w 'x 'y 'z) )
- 19 (DEFINE list3 (LIST 'j 'k 'l 'm 'l 'k 'j) )
- 20 (DEFINE list4 (LIST 'n 'o 'p 'q 'q 'p 'o 'n) )
- 21 (DEFINE list5 '((a b) c (d e d) c (a b)) )
- 22 (DEFINE list6 '((h i) (j k) l (m n)) )
- 23 (DEFINE list7 '(f (a b) c (d e d) (b a) f) )
- 24 ;
- 25 ; Here is a typical function definition
- 26 (DEFINE (adder lis)
- 27 (COND
- 28 ((NULL? lis) 0)
- 29 (ELSE (+ (CAR lis) (adder (CDR lis))))
- 30 ))
- 31 ; The above five lines are the sort of definition you would need to add to
- 32 ; this file if asked to define an ADDER function.
- 33 ; Uncomment and complete the following four definitions.
- 35
- 36 ; (DEFINE (odds ...
- 37
- 38 ; (DEFINE (evenrev ...
- 39
- 40 ; (DEFINE (penultimate ...
- 41
- 42 ; (DEFINE (palindrome ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement