meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
timothypratley 2020-03-03T15:37:58.109500Z

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?

timothypratley 2020-03-03T15:49:56.111700Z

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

grounded_sage 2020-03-03T16:55:35.111900Z

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 :)

noprompt 2020-03-03T21:13:58.112100Z

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

noprompt 2020-03-03T21:16:19.112300Z

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.

timothypratley 2020-03-03T22:03:16.112500Z

oh good thinking.

timothypratley 2020-03-03T22:03:31.112700Z

Does that help with the original question of “Meander to handle large column data”?

noprompt 2020-03-03T22:14:59.112900Z

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.