News for hackers. Stuff that matters.
Re:Functional-navigational programming in Clojure with Specter by rtpg on Tuesday September 29, 2015 @05:15AM (#10295253)
Wow, I love this. My impression is that Specter is (at least in main use cases) Haskell's lens package. But while lens is very inside-baseball (at least in the tutorials I read), this explanation describes an extremely useful principle.

Every language needs a lens/Specter. If you're spending a lot of time messing with data, this article will go directly to your heart.

Re:Functional-navigational programming in Clojure with Specter by dj-wonk on Tuesday September 29, 2015 @09:02AM (#10295902)
I think https://www.fpcomplete.com/school/to-infinity-and-beyond/pic... does a nice job of explaining a lens:

> At its simplest, a lens is a value representing maps between a complex type and one of its constituents. This map works both ways—we can get or "access" the constituent and set or "mutate" it. For this reason, you can think of lenses as Haskell's "getters" and "setters", but we shall see that they are far more powerful.

Re:Functional-navigational programming in Clojure with Specter by skratlo on Tuesday September 29, 2015 @05:51AM (#10295322)
Exactly what I thought, either lens or zippers.
Re:Functional-navigational programming in Clojure with Specter by tel on Tuesday September 29, 2015 @12:05PM (#10297265)
Definitely more lens than zipper. If you think of a lens, in simple form, as a path into a structure then a zipper is a structure plus a path into itself. This constrains the form that a zipper can take.

If you examine these paths on their own then you get into general "optics" which is where the lens type lives and where specter lives (it seems). In particular, we start talking about generalized folds and traversals.