(m/rewrite data
{:Data
{:EventId ?event-id
:Event ?event-name
:Sales {:Overall {:TicketCount ?sales-ticket-count
:Amount ?sales-amount}
:ByCategory [{:Name !names
:TicketCount !ticket-counts
:Amount !amounts
:ByReduction [{:Name !names
:TicketCount !ticket-counts
:Amount !amounts} ...]} ...]}}}
{:event {:id ?event-id
:name ?event-name}
:sales {:overall {:ticket-count ?sales-ticket-count
:amount ?sales-amount}
:by-category [{:name !names
:ticket-count !ticket-counts
:amount !amounts
:by-reduction [{:name !names
:ticket-count !ticket-counts
:amount !amounts} ...]} ...]}})
Hey @jimmy I found something unexpected with the answer you gave me. I actually trimmed down the data too much and there is further list nesting. This results in by-reduction
having a list of all reductions attached to just the first category name without returning the other category names as well.I'm going to add this to the cookbook today. You can fix this by doing the following
(m/rewrite data
{:Data
{:EventId ?event-id
:Event ?event-name
:Sales {:Overall {:TicketCount ?sales-ticket-count
:Amount ?sales-amount}
:ByCategory [{:Name !names
:TicketCount !ticket-counts
:Amount !amounts
:ByReduction [{:Name !names
:TicketCount !ticket-counts
:Amount !amounts} ..!n]} ..!m]}}}
{:event {:id ?event-id
:name ?event-name}
:sales {:overall {:ticket-count ?sales-ticket-count
:amount ?sales-amount}
:by-category [{:name !names
:ticket-count !ticket-counts
:amount !amounts
:by-reduction [{:name !names
:ticket-count !ticket-counts
:amount !amounts} ..!n]} ..!m]}})
I'm on my phone so I didn't get to test this. But it should work.https://cljdoc.org/d/meander/epsilon/0.0.383/doc/operator-overview#repeating-with-variables
Just fyi, there some stuff going on with cljdoc/circleci so the api docs are not working on the latest version. Here is a link to an old version that has all the information. meander isn't the only library affected, looking into it. https://cljdoc.org/d/meander/epsilon/0.0.373/doc/readme
Thank you for the quick responses @jimmy really appreciate your help.
> Instead of logic variables, we can capture multiple repeats with logic variables Looks like it should say memory variables instead of logic variables at the end
Fixed. Thanks
Fix the clj-doc issue. Docs should be all good now.