Document INDEXED-VALS.

This commit is contained in:
Michael Fogleman 2017-09-11 10:06:17 -04:00
parent c97d0edaca
commit 12472fa599

View file

@ -9,6 +9,7 @@
- [DISPENSE](#dispense)
- [END](#end)
- [FIRST](#first)
- [INDEXED-VALS](#indexed-vals)
- [LAST](#last)
- [MAP-KEYS](#map-keys)
- [MAP-VALS](#map-vals)
@ -154,6 +155,19 @@ nil
nil
```
## INDEXED-VALS
Navigates to [index elem] pairs for each element in a sequence. Transforms of index move element at that index to the new index, shifting other elements in the sequence. Indices seen during transform take into account any shifting from prior sequence elements changing indices.
```clojure
=> (select [INDEXED-VALS] [1 2 3 4 5])
[[0 1] [1 2] [2 3] [3 4] [4 5]]
=> (setval [INDEXED-VALS FIRST] 0 [1 2 3 4 5])
[5 4 3 2 1]
=> (setval [INDEXED-VALS FIRST] 1 [1 2 3 4 5])
[1 5 4 3 2]
```
## LAST
`LAST` navigates to the last element of a collection. If the collection is a map, returns a key-value pair `[key value]`. If the collection is empty, navigation stops.