indexed
function:
Map a list into a new list where each element in the new list is an object with two elements:
index
with the index of the element in the listvalue
with the element in the original list Can be used later for filters or map based on index. If the first argument is not a list will return nothing.
Examples:
- running:
(indexed [false, null, 10, {}])
will give:[{"value": false, "index": 0}, {"value": null, "index": 1}, {"value": 10, "index": 2}, {"value": {}, "index": 3}]
- running:
(indexed {})
will return nothing