lists.glisp 461 B

12345678910111213141516171819202122
  1. (assert (= '(1 2 3) (cons 1 '(2 3))))
  2. (assert (= 1 (first '(1 2 3))))
  3. (assert (= '(2 3) (rest '(1 2 3))))
  4. (assert (= 2 (first (rest '(1 2 3)))))
  5. (let [a 3]
  6. (assert (= '(0 3) (list 0 a))))
  7. (assert (= '(1 2 4 5) (concat '(1 2) '(4 5))))
  8. ; test not-list pairs
  9. (assert (= '(1 . 2) (cons 1 2)))
  10. (assert (= 2 (rest '(1 . 2))))
  11. (assert (not (list? '(1 . 2))))
  12. (assert (list? '()))
  13. (assert (list? '(1 2 3)))
  14. (assert (empty? '()))
  15. (assert (not (empty? '(1 2))))