This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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))) |