; test_list.lisp — pairs, lists, predicates, quoting. ; Run: cat test_list.lisp | ./lisp '() ; => () '(1 2 3) ; => (1 2 3) '(a b c) ; => (a b c) (cons 1 2) ; => (1 . 2) (cons 1 '(2 3)) ; => (1 2 3) (list 'x 'y 'z) ; => (x y z) (car '(11 22 33)) ; => 11 (cdr '(11 22 33)) ; => (22 33) (car (cdr '(1 2 3))) ; => 2 (car (cdr (cdr '(1 2 3)))) ; => 3 (null? '()) ; => #t (null? '(1)) ; => #f (pair? '(a)) ; => #t (pair? 'a) ; => #f (number? 42) ; => #t (number? 'foo) ; => #f (symbol? 'foo) ; => #t (symbol? 1) ; => #f (eq? 'a 'a) ; => #t (eq? 'a 'b) ; => #f ; nested literal '((1 2) (3 4) (5 6)) ; => ((1 2) (3 4) (5 6)) (car '((a b) (c d))) ; => (a b)