learning-sicp

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

exercise-13.scm (280B)


      1 (define-library (sicp solutions chapter-3 exercise-13)
      2   (import (scheme base))
      3   (export make-cycle)
      4 
      5   (begin
      6     (define (last-pair x)
      7       (if (null? (cdr x))
      8           x
      9           (last-pair (cdr x))))
     10 
     11     (define (make-cycle x)
     12       (set-cdr! (last-pair x) x)
     13       x)))