Freely giving software vs. perpetuating an ideology
dieggsy.com2 pointsby dieggsy0 comments
(defun calculate (instructions)
(reduce
(lambda (result op-value)
(destructuring-bind (operation value) op-value
(case operation
(:add (+ result value))
(:subtract (- result value))
(:multiply (* result value)))))
instructions
:initial-value 0))
(calculate '((:add 5) (:multiply 3) (:subtract 4))) ;; => 11
I have not tried it, I'm an Emacs nerd.