- Index
- »
- axon
- »
- func:flatMap
def
func:flatMap
flatMap(val, fn)
Map each item in a list or grid to zero or more new items as a flattened result.
If mapping a list, the mapping should be a function that takes (val)
or (val, index)
. It should return the a list of zero or more new values. See List.flatMap
.
If mapping a grid, the mapping function takes (row)
or (row,index)
and returns a list of zero or more new Dict rows. See Grid.flatMap
.
If mapping a stream, the mapping functions takes (val)
. See Streams.
Examples:
[1, 2, 3].flatMap(v => [v, v+10]) >> [1, 11, 2, 12, 3, 13]