Skip to content

Instantly share code, notes, and snippets.

View hypirion's full-sized avatar
👋

Jean Niklas L'orange hypirion

👋
View GitHub Profile
@hypirion
hypirion / test.clj
Created August 9, 2012 11:55 — forked from rf/test.clj
(defn lookup
"Lookup a variable in the model. Respects inversion of the variable if it is
specified with a - symbol. Returns nil if the variable is unset."
[[first-char :as var] model]
(if (= first-char \-) ; If the first character is '-'
(if-let [[_ val] (find model (subs var 1))] ; test for existence
(not val) ; invert value if exists
nil) ; otherwise return nil
(get model v)))