Fork me on GitHub
#specter
<
2018-09-20
>
okocim15:09:09

I’m a complete novice with specter (fired it up about a day ago), but I’m liking it so far. One thing that strikes me about the library is that it lends itself very well when you’re trying to simulate an “update in place” of a complex data structure. However, when I’m trying to completely change the shape of one data structure into a different structure (e.g. for transformation at a contract boundary), I find myself fighting with it a bit more. Am I right in my thinking that this is more suited for changing values in an existing data structure, or was this library also intended to help reshape data structures, and I’m not yet understanding which of the helpers are used for that. What I’ve been doing to date is calling select and collecting the values that I’m interested in, and then simply arranging the collected values into whatever shape I need. Is that the right approach?

nathanmarz17:09:28

@okocim you have it right, specter excels at doing partial changes of a data structure

nathanmarz17:09:55

if you're restructuring the whole thing, specter probably won't help that much

okocim18:09:18

@nathanmarz Thanks for confirming, and thanks for the library. The partial update use-case is the one that I primarily used this for, and it really does feel like you’re providing a piece that’s missing in core clojure :thumbsup: