learning-sicp

My embarrassing half assed SICP run.
git clone https://kaka.farm/~git/learning-sicp
Log | Files | Refs

exercise-17.scm (191B)


      1 ;; Exercise 2.17
      2 
      3 (define (last-pair xs)
      4   (cond
      5    ((pair? (cdr xs)) (last-pair (cdr xs)))
      6    (else xs)))
      7 
      8 (test-begin "2.17")
      9 (test-equal
     10     '(3)
     11   (last-pair '(1 2 3)))
     12 (test-end "2.17")