3 ms·
This is neat! When I first started reading and it described itself as "transforming nested data structures" I immediately thought of specter, which we use quite
by lvh 7y ago
This is neat! When I first started reading and it described itself as "transforming nested data structures" I immediately thought of specter, which we use quite a bit at Latacora. We've published a library, eidolon[0], with common specter navigators.
To get a feel for the difference I translated a few of the examples to what they would look like in specter.
A few things I learned:
- supdate is very useful if the data you have is already regular and not too convoluted. By comparison, most of the time the data I pass to specter is a giant (>100MB serialized and compressed) rat's nest (data from every AWS service under the sun).
- supdate is very good at this "implicit projection/selection" (in the relational algebra sense). It feels a lot more like Datomic pull syntax that way than specter. By comparison, the equivalent specter thing made me write a pretty complex multi-path with submap to get the same behavior. By comparison, specter feels better at the logic programming equivalent of this: in specter, I express the data I want to address and specter figures out where it lives; in supdate, I tell you exactly where it lives, structurally.
- Implicit selection (per previous point) feels like something that's maybe most valuable for data representation, so, UIs? To quote Perlis, "It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures.", so something I have done a few times with specter is write a navigator for commonly accessed things (like the actions in an AWS IAM statement) and then reuse that all over the place. It's harder for me to see how to do that in supdate, but I guess it's all data so it can't be that hard :)
In conclusion: I think it does what it says on the tin. There are things that it can't express (or at least I can't figure out how), but it's very clear at expressing the things it can. I probably won't end up using it, but that's not an indictment of the tool as much as it tells you what we use specter for :-)
[0]: https://github.com/latacora/eidolon https://github.com/latacora/eidolon