18 lines
443 B
Racket
18 lines
443 B
Racket
|
#lang racket
|
||
|
|
||
|
(with-input-from-file "../input/01"
|
||
|
(lambda ()
|
||
|
(for/fold ([cnt 0]
|
||
|
[last null]
|
||
|
#:result cnt)
|
||
|
([line (in-lines)])
|
||
|
(let ([num (string->number line)])
|
||
|
(if (< (length last) 3)
|
||
|
(values cnt (append last (list num)))
|
||
|
(values
|
||
|
(if (> num (car last))
|
||
|
(+ cnt 1)
|
||
|
cnt)
|
||
|
(append (cdr last) (list num))))))))
|
||
|
|