5 ms·
How is $ echo "$json" | cljq '(? $ "root" * 1)' more intuitive than the good ol' jq $ echo "$json" | jq '.root | map(.[1])' Really, people should kn
by behnamoh 2y ago
How is
$ echo "$json" | cljq '(? $ "root" * 1)'
more intuitive than the good ol' jq
$ echo "$json" | jq '.root | map(.[1])'
Really, people should know by now that jq does point-free programming.
- naniwaduni 2y agoWell you see, the author already knows common lisp, is familiar with their own ad hoc DSL by virtue of having just come up with it, and refuses to learn jq. Personally, I probably would've written '[.root[][1]]' for that problem myself though—not a huge fan of map/1.
- BoingBoomTschak 2y agoJust noticed this was submitted here. 1) I dislike that .[1] can be both an expression evaluated as a query and a "lambda". Really messes with my mind. 2) In my eyes, it's more intuitive because it looks like globbing and everybody knows globbing (this is the reason I use `**` too). But yeah, this is a bit subjective. What isn't, though, is that I don't plan on adding much more than that; maybe merge, transform and an accessor using the same syntax. So if you know the host language, there's much less friction. I really see this like Avisynth vs Vapoursynth.
- mpalmer 2y agoBut what you call a query is effectively just a function; it's a transformation on its input. jq calls them streams.
- BoingBoomTschak 2y agoHmmm, I think I see it now that you say it. Still strange to me, probably my brain dragging its feet against the syntax.