boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

11-list.scm (1374B)


      1 ;; List core: cons car cdr pair? null? list length list? append reverse
      2 ;; assoc member.
      3 (if (pair? (cons 1 2))
      4   (if (= (car (cons 1 2)) 1)
      5     (if (= (cdr (cons 1 2)) 2)
      6       (if (null? (quote ()))
      7         (if (if (null? (cons 1 2)) 0 1)
      8           (if (if (pair? (quote ())) 0 1)
      9             (if (= (length (list 1 2 3 4)) 4)
     10               (if (= (length (quote ())) 0)
     11                 (if (list? (list 1 2 3))
     12                   (if (list? (quote ()))
     13                     (if (if (list? 42) 0 1)
     14                       (if (= (length (append (list 1 2) (list 3 4))) 4)
     15                         (if (= (car (append (list 1 2) (list 3 4))) 1)
     16                           (if (= (length (reverse (list 1 2 3))) 3)
     17                             (if (= (car (reverse (list 1 2 3))) 3)
     18                               (if (= (cdr (assoc (quote b)
     19                                                  (list (cons (quote a) 1)
     20                                                        (cons (quote b) 2)))) 2)
     21                                 (if (if (assoc (quote z)
     22                                                (list (cons (quote a) 1))) 0 1)
     23                                   (if (= (car (member 3 (list 1 2 3 4))) 3)
     24                                     (if (if (member 99 (list 1 2 3)) 0 1)
     25                                       42 0) 0) 0) 0) 0) 0) 0) 0) 0) 0) 0) 0) 0) 0) 0) 0) 0) 0) 0)