clojuredesign-podcast

Discussions around the Functional Design in Clojure podcast - https://clojuredesign.club/
lodin 2019-07-08T19:11:56.003Z

@nate @neumann Hi! I like your podcast. It's nice to follow along in the thought processes--that's often missed in blogs etc. A comment on the last episode; you said you couldn't avoid using lazy-seq. You can use iterate though, like (->> lines (iterate rest) (take-while seq) (map parse-next) (filter some?)).

neumann 2019-07-08T19:14:29.003700Z

@lodin.johan Welcome! Glad to have you here!

neumann 2019-07-08T19:17:02.004600Z

@lodin.johan Thank for the feedback. I'll have to try that out. I haven't used iterate like that before.

neumann 2019-07-08T19:19:25.004800Z

That looks pretty nifty!

lodin 2019-07-08T19:59:06.005400Z

@neumann Thanks! Yeah, it's pretty useful. I've used it when I needed the function to "consume" the sequence as well. In that case I iterate over [nil lines] with (fn [[_ lines]] (when (seq lines) (f lines))) where f should return [thing remaining-lines]. (`f` should return [nil (rest lines)] if it "does nothing" instead of nil.)