Skip to content

Instantly share code, notes, and snippets.

@tomaszperek
Last active August 29, 2015 14:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tomaszperek/ac79bf0c79a5a461e45c to your computer and use it in GitHub Desktop.
#simple example
=> (if nil "yes" "no")
"no"
# "elvis"
=> (or nil "Some value")
"Some value"
# if-let construct
=> (if-let [a-value (:a a-map)]
(do-something-with-a-value a-value)
"A value not foud")
#
# safe operations on vectors
=> (first [])
nil
=> (first nil)
nil
# safe operations on maps
=> (get-in nil [:a :b])
nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment