learning-sicp

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

exercise-8.scm (393B)


      1 (define-library (sicp solutions chapter-3 exercise-8)
      2   (import (scheme base))
      3   (export
      4    make-f
      5    )
      6 
      7   (begin
      8     (define (make-f)
      9       (define first-internal-value 'still-undecided)
     10 
     11       (define (f x)
     12         (if (eq? first-internal-value 'still-undecided)
     13             (begin
     14               (set! first-internal-value
     15                     x)
     16               0)
     17             x))
     18 
     19       f)))