Fork me on GitHub
#meander
<
2021-09-15
>
Richie17:09:00

In https://github.com/noprompt/meander/blob/epsilon/doc/operator-overview.md#rest What’s happening in

(m/match #{1 2 3}
  #{^& ?rest}
  ?rest)
What is & contributing here? More importantly what’s ^ contributing here??

Ben Sless19:09:18

I'm guessing it's a hack to be able to rest match a set, so it's attached as a tag

Ben Sless19:09:22

because sets are unordered

ribelo19:09:59

(m/match #{1 2 3}
  #{1 ^& ?rest}
  ?rest)
;;=> #{2 3}

ribelo19:09:30

allows you to match the rest of the elements from the set

ribelo19:09:35

macro expands to cojure.set/difference

Richie23:09:27

Woa, thanks. I didn’t think to macroexpand but I can actually read the code I get out of macroexpanding that example!

🙂 2