aoc2021/rkt/01.1.rkt

15 lines
365 B
Racket
Raw Normal View History

2021-12-02 18:13:56 +07:00
#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)])
(values (cond [(null? last) cnt]
[(> num last) (+ cnt 1)]
[else cnt])
num)))))