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 14:42

How would you do this efficiently in a purely functional way? It's for simplifying a multiplication.
; Not tested, but I hope you get the idea.
(let ((vars nil)
      (consts nil))
  (dolist (x terms `(* ,@vars ,(apply #'* consts)))
; AIF is the anaphoric if macro.
; CONST tries to coerce its parameter into a constant number and returns NIL if it can't.
    (aif (const x)
      (if (zerop it)
        (return 0)
        (push it consts))
      (push x vars))))

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