blob: 31e3c994c39fbef5e8b706619de6f98a120e97f7 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 | ; return 1 if next three greater than first three
(func is-increasing (inp)
    (if (< (apply + (most inp)) (apply + (rest inp)))
        1
        0))
; this works, but i don't like redefining variables
(func iter-list (inp)
    (def acc 0)
    (for-count (- (length inp) 3)
        (redef acc (+ acc (is-increasing (slice inp _idx_ 4)))))
    acc)
(def lines 
    (map string->int
        (map strip
            (read-lines "input.txt"))))
(print (->string (iter-list lines)))
 |