4 ms·
Clojure is already good at that- at conditional pipe / filter / aggregate semantics, bc it is a lisp. Specter is for a different problem. When you have a data s
by jonahbenton 6y ago
Clojure is already good at that- at conditional pipe / filter / aggregate semantics, bc it is a lisp. Specter is for a different problem. When you have a data structure that has some semantics and is deeply nested (and you aren't discovering the structure, like getting size from a node via a function call) Specter has a declarative set of operations to navigate and extract on that data structure, extremely efficiently.
- kazinator 6y ago1> (defstruct node () item next) #<struct-type node> 2> (new node next (new node next (new node item 42))) #S(node item nil next #S(node item nil next #S(node item 42 next nil))) 3> (call .next.next.item *2) 42
- reitzensteinm 6y agoI don't usually have a problem with you posting TXR comparisons in every lisp thread, but if you're not going to take the time to understand what the library does, this is just spam.
- deleted 6y ago[deleted]
- kimi 6y agoAdding a bit of context - as Clj data structures are immutable, changing something that is deeply nested cannot be done in-place (like in a Java set of nested objects - navigate until you find the one you need, call setFoo() on it, you're done). So it gets painful real quick. Specter is like search-and-replace - first you find all the elments you need, then you can replace / change them at the touch of a fn.