Fork me on GitHub
#clojuredesign-podcast
<
2019-07-08
>
lodin19:07:56

@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?)).

neumann19:07:29

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

neumann19:07:02

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

neumann19:07:25

That looks pretty nifty!

lodin19:07:06

@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.)