; add the first three items (func first-three (inp) (apply + (list (first inp) (first (rest inp)) (first (rest (rest inp)))))) ; return 1 if next three greater than first three (func is-increasing (inp) (if (< (first-three inp) (first-three (rest inp))) 1 0)) ; this works, but i don't like redefining variables ; also this is slow, maybe there needs to be slices (func iter-list (inp) (def acc 0) (def prev inp) (for-count (- (list-length inp) 3) (redef acc (+ acc (is-increasing prev))) (redef prev (rest prev))) acc) (def lines (map string->int (map strip (read-lines "input.txt")))) (print (->string (iter-list lines)))