Skip to content

Instantly share code, notes, and snippets.

@munro
Created December 24, 2015 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save munro/8a7073b09dc3e02d7605 to your computer and use it in GitHub Desktop.
Save munro/8a7073b09dc3e02d7605 to your computer and use it in GitHub Desktop.
(defn foo-or-bar[x]
(let [x-type (:type x)
x-foo (delay (:foo x))
x-bar (delay (:bar x))]
(cond
(= x-type "foo") @x-foo
(= x-type "bar") @x-bar)))
(foo-or-bar {:type "foo" :foo "I am foo!"})
(foo-or-bar {:type "bar" :bar "I am bar!"})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment