> collect [foreach x a [if block? x [keep x]]] == [1 2 3 3] But what I want is [[1 2] [3 3]]. It see" /> > collect [foreach x a [if block? x [keep x]]] == [1 2 3 3] But what I want is [[1 2] [3 3]]. It see" /> > collect [foreach x a [if block? x [keep x]]] == [1 2 3 3] But what I want is [[1 2] [3 3]]. It see"/>

How to prevent "collect/keep" function from flatting its result

52 Views Asked by At
>> a: [[1 2] "a" a [3 3]]
== [[1 2] "a" a [3 3]]
>> collect [foreach x a [if block? x [keep x]]]
== [1 2 3 3]

But what I want is [[1 2] [3 3]]. It seems that collect/keep would flat the result(in term of block). How to prevent it?

1

There are 1 best solutions below

0
9214 On BEST ANSWER

Use keep/only. FYI, keep has almost the same semantics as append (barring a few refinements) with an implicit block that collect provides internally: see ?? collect for the details.