Skip to content

bullet log

Chouser edited this page Feb 27, 2021 · 5 revisions

Notes about cq

Notes / Tasks (.) / Events (o) / Thoughts (-)

Collections:

Topics

Callable keywords

It’s nice that in Clojure you can say (-> foo :a :b :c) takes advantage of -> adding parens if you don’t provide any cq would currently need (| foo (get :a) (get :b) (get :c)) So, should keywords eval to themselves (as do numbers, strings, etc.) or look themselves up in a map? We could change the default to lookup and require quote to eval to self: (| foo :a :b :c) and (| {‘:a 10, ‘:b 20} (get ‘:a)) bleh That’s ugly – try to make in context-sensitive

modify on non-paths

jq complains. Our new nav-based approach does a pretty useless degenerative result: (cq/eval 42 (cq/with-refer-all [cq] (modify 43 .))) ;; => (42) If we want to complain, we could check in:

  • modify: as soon as we invoke the nav-mf, assert all items are navs
  • or have the Object INavigation complain, but have nav-get (and all other nav ctors) check at construct time that their parent implements INavigation and wrap it in a terminal nav if not.
  • In both cases, how to detect if an object is an nav or not when all objects have a default impl.
    • Maybe use chart (empty vector is not a nav), or some new protocol method like `is-root?`?

Maybe don’t complain (Clojure complains on empty vectors for update, and we hate it), and for jq-compatiliby wrap modify in jq-modify that checks the naviness (still need to choose how)

How shall we communicate about this project?

Describing this to kids via Minecraft analogy Tension between parts and wholes oo says make an object (parts are hidden, “enapsulated”) functional programmers say it’s all data (you can see the data parts) jq/cq give us a different way to describe partial-wholes: compare to lazy seq pipelines and transducers?

Daily

2021-02-26

o Discussed the flattening behavior of sequences in [vector] constructors o Do we want to lift vector to get combinatorics and multiple returns? And leave [] to act like jq (ie. [& …]) jq carefully documents the “collecting” behavior of arrays, but doesn’t call out that you have lost the ability to return multiple vectors. The language needs both exploding (jq’s `combinations`) and collecting (jq’s []) How do we want to provide these? We could expose combinations and keep our [] like jq We could expose list and/or vector for exploding (aligns well with only-explicit .) and for collecting… …something like into? `collect-into` …but no way to collect into a lazy-seq . Make [] act like lifted vector (abandon jq) . Write collect-into (ignore lazy-seqs for now); make combinations from target collection? o Discovered jq’s `combinations` o Discussed, again, the possiblity of having none of our cq functions directly use the threaded value. Still pass it through to arg mfs. Are there any examples where it’s really important to follow jq here? We haven’t thought of any. Got one! You don’t have to define behavior of a stream arg because threaded value can’t be a stream . update all fns and the jq-compiler to abandon all implicit threaded args . fix t61 o Docs should be clear about which args are used for navs vs not

2021-02-25

o Discussed names of invoke (), eval, navigate o Reviewed assign o Discussed Callable keywords o Discussed value of pairing vs code reviews o Discussed bullet journaling method o How shall we communicate about this project? o Discussed modify on non-paths o Discovered jq is inconsistent in cartesian-product order: slice vs + vs {} ??? so, we need a cartesian-product-> and cartesian-product-<-, if we want to follow jq

Clone this wiki locally