Initial commit
This commit is contained in:
commit
f242d2b0df
420 changed files with 62521 additions and 0 deletions
25
2021/day01/day01_r7rs.scm
Normal file
25
2021/day01/day01_r7rs.scm
Normal file
|
@ -0,0 +1,25 @@
|
|||
(cond-expand
|
||||
(r7rs)
|
||||
(chicken (import r7rs)))
|
||||
|
||||
(import (scheme base)
|
||||
(scheme write)
|
||||
(scheme cxr)
|
||||
(srfi 1))
|
||||
|
||||
(define (read-input)
|
||||
(let lp ((lines '()))
|
||||
(if (and (not (null? lines)) (eof-object? (car lines)))
|
||||
(map string->number (reverse (cdr lines)))
|
||||
(lp (cons (read-line (current-input-port)) lines)))))
|
||||
|
||||
(define (part1 l) (count < l (cdr l)))
|
||||
|
||||
(define (part2 l) (count < l (cdddr l)))
|
||||
|
||||
(let ((in (read-input)))
|
||||
(write (part1 in))
|
||||
(newline)
|
||||
(write (part2 in))
|
||||
(newline))
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue