Fork me on GitHub
#meander
<
2023-05-16
>
igrishaev08:05:13

Can anyone help me with meander? Imagine I want the first form to become the second:

igrishaev08:05:11

{:tags [{:name "AAA"} {:name "BBB"}]}
->
{:tags ["AAA" "BBB"]}
here is what I have in my code:
(matcher
 {:pattern    '{:tags [{:name ?tag} ...]}
  :expression '{:tags [!tags]}})
But sometimes, I'm getting an exception saying "Non-exhaustive pattern match" or something

igrishaev08:05:08

Let me correct myself:

:tags  [{:name !tags} ...]
:tags  !tags
Sometimes, it leads to => ExceptionInfo: non exhaustive pattern match {}

igrishaev09:05:56

turned out, the exception pops up when the tags field is missing or nil. How can I correct the pattern so the nil tags produce either nil or an empty vector?

igrishaev09:05:00

phew, it should have been (m/or nil [{:name !tags} ...])