group together items in collection that abide by given predicate
Parameters
cluster collection :integer :string :literal :dictionary :object :inline :block :range
params :null :literal :block
condition :block :bytecode
Attributes
with |
:literal |
use given index |
value |
:any |
also include condition values |
Returns
Examples
copy
cluster 1..10 => odd?
cluster 1..10 'x -> prime? x
copy
cluster 1..10 [x y] -> 10 < x+y
copy
cluster.value 1..10 'x -> prime? x
copy
#.raw flatten.once cluster.value 1..10 'x [
(prime? x)? -> "prime"
-> "composite"
]
copy
cluster.with: 'i ["one" "two" "three" "four" "five" "six"] [] -> even? i
Related