てきとーに書いた。ハイライトさせたいな
(defmacro case [base-value & patterns] (cons 'cond (fold (fn [[val & more] res] (concat res (list (if (= val :else) val `(= ~base-value ~val)) (first more)))) ( (partition 2 patterns)))))
24 Apr 2010
てきとーに書いた。ハイライトさせたいな
(defmacro case [base-value & patterns] (cons 'cond (fold (fn [[val & more] res] (concat res (list (if (= val :else) val `(= ~base-value ~val)) (first more)))) ( (partition 2 patterns)))))