Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Simple made easy

Name: Anonymous 2011-10-21 10:06

http://www.infoq.com/presentations/Simple-Made-Easy

Rich Hickey's presentation which received a standing ovation from Dr. Sussman.

Name: Anonymous 2011-10-22 15:01

>>69
It's a simple accumulator loop.
(define (simplify terms)
 (let loop ((terms terms) (vars '()) (consts '()))
  (cond ((null? terms) `(* ,@vars ,(apply * consts)))
         (const (car terms))
          => (lambda (x)
              (if (zero? x) 0
                  (loop (cdr terms) vars
                        (cons x consts)))))
         (else (loop (cdr terms) (cons x vars) consts)))))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List