DEV Community

Discussion on: AoC Day 1: Chronal Calibration

Collapse
 
trueneu profile image
Pavel Gurkov

On the Clojure pt 2, you're effectively running an endless loop. You always take the first element from the cycled number collection, so you'll never hit the exit condition.
To avoid this while using the approach you chose, add a third numbers binding to the loop, and pass (rest numbers) when recuring, while computing total using (first numbers).

Collapse
 
rhymes profile image
rhymes

Thanks! I then solved it thanks to this post

exactly like you said. You can see my version here github.com/rhymes/aoc2018/blob/mas...