meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
2020-06-10T01:16:11.400400Z

(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 trouble

2020-06-10T01:24:14.401Z

I 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]]

jimmy 2020-06-10T02:33:15.401600Z

I think cata is the way I'd recommend.