September 10th, 2015
In Technology
No Comments
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
Use Specter to transform Clojure’s lists
(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.
To change the name of all the stations named “Barista” to “Coffee Master”, I can use a for comprehension:
(for [site sites station (:stations site)] (if (= (:name station) "Barista") (assoc station :name "Coffee Master") station))But using Specter:
(->> sites (transform [ALL :stations ALL #(= (:name %) "Barista")] #(assoc % :name "Coffee Master")))Now, this example is not actually doing justice to Specter. But in a previous (superseded) versions of the system, Specter replaced what would have been some really hairy logic with a two lines of code. I expect to be using it more in the future.
Post external references
- 1
http://sapient-pair.com/blog/2015/09/03/for-clarity/
February 8, 2022 9:33 am
From Michael S on How I recovered from Lyme Disease: I fasted for two weeks, no food, just water
"Did you have Bartonella, too? Seems it uses autogenesis..."