A fork of Crisp for HARP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
647 B

  1. ;; Testing REPL_ENV
  2. (+ 1 2)
  3. ;=>3
  4. (/ (- (+ 5 (* 2 3)) 3) 4)
  5. ;=>2
  6. ;; Testing def!
  7. (def! x 3)
  8. ;=>3
  9. x
  10. ;=>3
  11. (def! x 4)
  12. ;=>4
  13. x
  14. ;=>4
  15. (def! y (+ 1 7))
  16. ;=>8
  17. y
  18. ;=>8
  19. ;; Testing let*
  20. (let* (z 9) z)
  21. ;=>9
  22. (let* (x 9) x)
  23. ;=>9
  24. x
  25. ;=>4
  26. (let* (z (+ 2 3)) (+ 1 z))
  27. ;=>6
  28. (let* (p (+ 2 3) q (+ 2 p)) (+ p q))
  29. ;=>12
  30. ;; Testing outer environment
  31. (def! a 4)
  32. ;=>4
  33. (let* (q 9) q)
  34. ;=>9
  35. (let* (q 9) a)
  36. ;=>4
  37. (let* (z 2) (let* (q 9) a))
  38. ;=>4
  39. ;;
  40. ;; -------- Optional Functionality --------
  41. ;; Testing let* with vector bindings
  42. (let* [z 9] z)
  43. ;=>9
  44. (let* [p (+ 2 3) q (+ 2 p)] (+ p q))
  45. ;=>12
  46. ;; Testing vector evaluation
  47. (let* (a 5 b 6) [3 4 a [b 7] 8])
  48. ;=>[3 4 5 [6 7] 8]