Hi! Just so I can understand the desire here I’ll attempt to rephrase as:
I wish meander sequence patterns like (!xs ...) used transducers instead of memory variables.
^^ is this accurate?
i.e.: The issue is that very long sequences don’t fit in memory? Or is it a different problem?(defn unarchived' [stories]
(remove (fn [{:keys [archived completed]}]
(and archived (not completed)))
stories))
(def unarchived
(s/rewrite
((m/or {:archived true
:completed false}
!stories) ...)
;;>
(!stories ...)))
^^ for a really big CSV !stories
needs to be a sequence, not an array.
Conversely when do we need an array not a sequence?I’m still new to all of this so having some trouble keeping up. Though I am willing to dive in and contribute to this problem with a bit of guidance :)
(keep
(fn [value]
(me/rewrite value
{:archived false, :completed true :as ?it}
?it))
'({:archived true, :completed true}
{:archived false, :completed true}
{:archived true, :completed false}
{:archived false, :completed false}))
;; =>
({:archived false, :completed true})
would be decent.This also works
(me/rewrites '({:archived true, :completed true}
{:archived false, :completed true}
{:archived true, :completed false}
{:archived false, :completed false})
(me/scan {:archived false, :completed true :as ?it})
?it)
;; =>
({:archived false, :completed true})
but rewrites
doesn’t support cata
FYI.oh good thinking.
Does that help with the original question of “Meander to handle large column data”?
It can. It just depends on what you are using. If you use a single …
in a pattern, Meander has to apply pattern matching to everything in the collection in question. If you can rephrase the pattern in such a way that search
becomes applicable its nice to go that way.