day07: reformat a little

This commit is contained in:
Sijmen Schoon 2021-12-09 14:00:15 +01:00
parent 299ccb33d0
commit 1a9a998460
Signed by: vijfhoek
GPG key ID: DAF7821E067D9C48

View file

@ -9,10 +9,8 @@
; PART 1
(let* ((sorted (sort numbers <))
(median (list-ref sorted (floor/ (length numbers) 2)))
(part1
(foldl (lambda (x y) (+ x (abs (- y median))))
0
numbers)))
(part1 (foldl (lambda (x y) (+ x (abs (- y median))))
0 numbers)))
(format #t "part 1: ~A~%" part1))
; PART 2
@ -20,8 +18,7 @@
(define (part2- avg)
(foldl (lambda (x y) (+ x (triangular (abs (- y avg)))))
0
numbers))
0 numbers))
(let* ((len (length numbers))
(sum (foldl + 0 numbers))