Guest User

Untitled

a guest
Feb 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. ;Exercise 1.1 - Given the Scheme code, what's the output?
  2.  
  3. 10
  4. ;10
  5.  
  6. (+ 5 3 4)
  7. ;12
  8.  
  9. (- 9 1)
  10. ;8
  11.  
  12. (/ 6 2)
  13. ;3
  14.  
  15. (define a 3)
  16. ;a
  17.  
  18. (define b (+ a 1)
  19. ;b
  20.  
  21. (+ a b (* a b))
  22. ;19
  23.  
  24. (= a b)
  25. ;#f
  26.  
  27. (if (and (> b a) (< b (* a b)))
  28. b
  29. a)
  30. ;4
  31.  
  32. (cond ((= a 4) 6)
  33. ((= b 4) (+ 6 7 a))
  34. (else 25))
  35. ;16
  36.  
  37. (+ 2 (if (> b a) b a))
  38. ;6
  39.  
  40. (* (cond ((> a b) a)
  41. ((< a b) b)
  42. (else -1))
  43. (+ a 1))
  44. ;16
Add Comment
Please, Sign In to add comment