I used to think of
as-> as something I’d reach for when I needed to thread something into a middle position, but I just realized that it could just be used to add names to intermediate results, a bit like let, except I feel it might even be more readable.
What do you all think?
(-> (process payload) (as-> customer (get-cart customer)) (as-> cart (checkout cart)))
(-> (process payload) (get-cart) (checkout))
(let [customer (process payload) cart (get-cart customer)] (checkout cart))
It reminds me a bit of SQL, and I feel it reads pretty nicely.