Hi! I'm making an app for a local non-profit organization which helps homeless people ( http://homeless.ru ). This is pro-bono work. It's a small reagent SPA which talks with their CRM via an API. This is my first kinda real Clojure[script] project, so I'll be very grateful for any tips on improving the code. Most of the code is here: https://github.com/jehaby/mks/blob/humaid/shared/humaid/src/main/humaid/app.cljs
1❤️As you said, interleave
works too, but it looks a bit more awkward to my eyes:
(defn expr->where-clause [attrs from to]
(let [syms (->> #(symbol (str "?" (gensym)))
(repeatedly (dec (count attrs))))]
(->> (conj (vec syms) to)
(interleave attrs)
(cons from)
(partition 3 2))))
@jaihindhreddy nice. That's fairly clean. I tried and failed to get parition and interleave to get this to work. i think i was relying on the padding and not cons the from.
@smith.adriane thanks for the review. i cleaned it up based on this then went another direction using reduce then ponged back to what jaihindhreedy has there. 2 hours of fiddling. 🙂
1🙂