(def body2 [1 2 3 '=> nil
5 6 '=> nil
8 '=> nil])
(m/rewrite body2
(m/scan !xs ..!n '=> ?v)
[[!xs ..!n] ?v])
; [[1 2 3] nil]
How do I make it return all the matches, not just one? I see rewrites but having troubleI got it with cata, but maybe there is a better way
(m/rewrite body2
[] []
[!xs ... '=> ?v & ?more]
[[!xs ... ?v] & (m/cata ?more)])
; [[1 2 3 nil] [5 6 nil] [8 nil]]
I think cata is the way I'd recommend.