Skip to content

Instantly share code, notes, and snippets.

@wjlroe
Created November 16, 2015 10:03
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 wjlroe/063313e9b310217ae54e to your computer and use it in GitHub Desktop.
Save wjlroe/063313e9b310217ae54e to your computer and use it in GitHub Desktop.
Ruby's (2.3.0) dig and Clojure's get-in
(def people [{:name "Will"
:health 1}
{:name "Not Will"
:health -10}])
(get-in people [0 :name]) #=> "Will"
people = [
{name: "Will", health: 1},
{name: "Not will", health: -1}
]
people.dig(0, :name) #=> "Will"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment