get in
get a value from a nested data structure
(any xs, list keys, any notFound) -> any
Accesses nested list and dict values in xs
using the given list of keys
. Returns the found value.
Returns notFound
if any of the keys is not present.
Returns nil
if xs
is nil
, or keys
is nil
. Returns xs
if keys
is an empty list.
Throws an error when trying to access a data structure that is neither a dict or list.
Throws an error or when a key value cannot be cast to the appropriate key type of the data structure.
Parameters
Name | Type | Description |
---|---|---|
xs |
dict or list | The dict or list to access |
keys |
list | The keys and indexes to access |
notFound |
any |
The value to return in case one of the keys is not present in xs |