Advertisement
Guest User

Chegg Question

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