day07: reformat a little
This commit is contained in:
parent
299ccb33d0
commit
1a9a998460
1 changed files with 3 additions and 6 deletions
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue