@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?))
.
@lodin.johan Welcome! Glad to have you here!
@lodin.johan Thank for the feedback. I'll have to try that out. I haven't used iterate
like that before.
That looks pretty nifty!
@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
.)