:error • get_and_update(data, key, function) ◦ Returns tuple with old value and new data • pop(data, key) ◦ Returns tuple with old value and new data or default
of given key • Is the reason we have bracket notation • Used in Kernel macros such as get_in • artists["beyonce knowles"] • Access.get(artists, "beyonce knowles") ◦ => %{ age: 37, songs: [ %{genre: "bounce", title: "formation"}, %{genre: "r&b", title: "beautiful liar"} ], stage_name: "beyonce” } • Artists[“the strokes”] ◦ => nil • Access.get(artists, "the strokes", %{stage_name: "the strokes"}) ◦ => %{stage_name: "the strokes"}
of the function is to access the value for the given key • put_in(artists, [Access.key("natalie", %{}), Access.key(:age)], 25) ◦ => %{ age: 37, songs: [ %{genre: "bounce", title: "formation"}, %{genre: "r&b", title: "beautiful liar"} ], stage_name: "beyonce” , "natalie" => %{age: 25} }
returns function to access provided key Access.all => returns function that accesses all elements in a list Access.filter => returns function that accesses specific elements in a list Access.at => returns function that accesses particular element in list