diff options
-rwxr-xr-x | 2-2.scm | 9 | ||||
-rwxr-xr-x | 2.scm | 2 |
2 files changed, 2 insertions, 9 deletions
@@ -4,10 +4,6 @@ (ice-9 textual-ports) (srfi srfi-1)) -(define red-max 12) -(define green-max 13) -(define blue-max 14) - (define (read-lines port) (letrec ((loop (lambda (l ls) (if (eof-object? l) @@ -28,9 +24,8 @@ (values (map triplet-values rest)) (red-min (fold (lambda (x y) (if (> x y) x y)) 0 (map car values))) (green-min (fold (lambda (x y) (if (> x y) x y)) 0 (map cadr values))) - (blue-min (fold (lambda (x y) (if (> x y) x y)) 0 (map caddr values))) - (power (* red-min green-min blue-min))) - power)) + (blue-min (fold (lambda (x y) (if (> x y) x y)) 0 (map caddr values)))) + (* red-min green-min blue-min))) (let* ((port (open-input-file "2.txt")) (lines (read-lines port))) @@ -29,8 +29,6 @@ (valid? (fold (lambda (x y) (and x y)) #t (map valid-triplet? rest)))) (if valid? id 0))) -(line-value "Game 38: 2 blue, 4 green, 11 red; 7 green, 6 red, 2 blue; 1 green, 3 red, 1 blue; 4 blue, 4 green, 4 red; 2 red, 5 blue, 2 green") - (let* ((port (open-input-file "2.txt")) (lines (read-lines port))) (close-port port) |