Fork me on GitHub
#gratitude
<
2022-10-28
>
saleem khatib19:10:50

Thank to the Clojure team for clojure.core/iteration and core.async/pipeline it is exactly the right abstraction and saves me a lot from imperative code

😎 3
gratitude 9
clojure-spin 2
ghadi20:10:49

this makes me very happy! if you want to share about how you are using iteration, I'm curious

❤️ 2
lilactown21:10:30

agreed here! i just used it yesterday to run through all the pages of my calendar via the google API to automate exports 🙏:skin-tone-2:

saleem khatib21:10:25

an api , notion, returns a paginated results of ids and a next key to fetch extra results. I was fetching the results imperatively and my business logic was deep inside the loop. One day I took a look at clojure cheatsheet and suprise clojure.core 1.11 has an interesting function called iteration. Oh it returns a seqable and reducable object to fetch api's. this is exactly what I want with clojure.core.async/onto-chan and clojure.core.async/pipeline my function ran with the same speed and more concise

saleem khatib21:10:59

what was like a 20 or so line function is just 3 lines, one for fetching one for pipeline to fetch result for each id and one for reducing

💡 2