Skip to content

Instantly share code, notes, and snippets.

@tdammers tdammers/def-strict
Created Jul 1, 2015

Embed
What would you like to do?
def thwarting laziness?
user=> (defn foo [& fns] (fn [] (->> fns (map #(%)) (filter (comp not nil?)) (first))))
#'user/foo
user=> ((foo (fn [] nil) (fn [] "OK") (fn [] (do (print "NONONO") "NO"))))
"OK"
user=> (def blah (foo (fn [] nil) (fn [] "OK") (fn [] (do (print "NONONO") "NO"))))
#'user/blah
user=> (blah)
NONONO"OK"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.