From 9ff74cff61a2f81d8a237ca5363c3c643620ca88 Mon Sep 17 00:00:00 2001 From: Filip Lajszczak Date: Wed, 28 Dec 2022 20:39:41 +0000 Subject: [PATCH] Explicit is better then implicit. --- advent01.scm | 11 ++++++----- advent02.scm | 10 ++++++---- advent03.scm | 10 ++++++---- advent04.scm | 9 +++++---- advent05.scm | 16 ++++++++++++---- advent06.scm | 9 +++++---- advent07.scm | 10 ++++++---- advent08.scm | 11 ++++++----- 8 files changed, 52 insertions(+), 34 deletions(-) diff --git a/advent01.scm b/advent01.scm index 3c9272f..9c7e797 100644 --- a/advent01.scm +++ b/advent01.scm @@ -1,11 +1,12 @@ #!/usr/bin/guile -s !# -(use-modules (srfi srfi-1) - (srfi srfi-13) - (srfi srfi-64) - ((f)) - ((algorithms))) +(use-modules ((srfi srfi-1) #:select (take)) + ((srfi srfi-64) #:select (test-begin + test-end + test-equal)) + ((f) #:select (read-text)) + ((algorithms) #:select (sum))) (define (part-1 filename) (apply max (map sum (input filename)))) diff --git a/advent02.scm b/advent02.scm index 9f21c7a..011295b 100644 --- a/advent02.scm +++ b/advent02.scm @@ -1,10 +1,12 @@ #!/usr/bin/guile -s !# -(use-modules (ice-9 match) - (srfi srfi-64) - ((f)) - ((algorithms))) +(use-modules ((ice-9 match) #:select (match)) + ((srfi srfi-64) #:select (test-begin + test-end + test-equal)) + ((f) #:select (read-lines)) + ((algorithms) #:select (sum))) (define (part-1 filename) (sum (map score (input filename)))) diff --git a/advent03.scm b/advent03.scm index df9468f..dba74a6 100644 --- a/advent03.scm +++ b/advent03.scm @@ -1,10 +1,12 @@ #!/usr/bin/guile -s !# -(use-modules (srfi srfi-1) - (srfi srfi-64) - ((f)) - ((algorithms))) +(use-modules ((srfi srfi-1) #:select (first last)) + ((srfi srfi-64) #:select (test-begin + test-end + test-equal)) + ((f) #:select (read-lines)) + ((algorithms) #:select (chunks-of sum))) (define (halve lst) (chunks-of lst (/ (length lst) 2))) diff --git a/advent04.scm b/advent04.scm index 184773d..aecf618 100644 --- a/advent04.scm +++ b/advent04.scm @@ -1,10 +1,11 @@ #!/usr/bin/guile -s !# -(use-modules (srfi srfi-1) - (srfi srfi-64) - ((f)) - ((algorithms))) +(use-modules ((srfi srfi-1) #:select (first last)) + ((srfi srfi-64) #:select (test-begin + test-end + test-equal)) + ((f) #:select (read-lines))) (define (parse-line line) (map (λ (range) (map string->number (string-split range #\-)))(string-split line #\,))) diff --git a/advent05.scm b/advent05.scm index 2639a32..e37b041 100644 --- a/advent05.scm +++ b/advent05.scm @@ -1,10 +1,18 @@ #!/usr/bin/guile -s !# -(use-modules (srfi srfi-1) - (srfi srfi-64) - ((f)) - ((algorithms))) +(use-modules ((srfi srfi-1) #:select (drop-right + first + last + second + take-right + third + zip)) + ((srfi srfi-64) #:select (test-begin + test-end + test-equal)) + ((f) #:select (read-lines)) + ((algorithms) #:select (chunks-of))) (define (parse-boxes line) (map diff --git a/advent06.scm b/advent06.scm index 5a5b26f..4fd17f0 100644 --- a/advent06.scm +++ b/advent06.scm @@ -1,10 +1,11 @@ #!/usr/bin/guile -s !# -(use-modules (srfi srfi-1) - (srfi srfi-64) - ((f)) - ((algorithms))) +(use-modules ((srfi srfi-64) #:select (test-begin + test-end + test-equal)) + ((f) #:select (read-text)) + ((algorithms) #:select (sliding))) (define (scan lst index size) (if (eq? (char-set-size (list->char-set (car lst))) size) diff --git a/advent07.scm b/advent07.scm index 3f2d766..ae2b264 100644 --- a/advent07.scm +++ b/advent07.scm @@ -1,10 +1,12 @@ #!/usr/bin/guile -s !# -(use-modules (srfi srfi-1) - (srfi srfi-64) - ((f)) - ((algorithms))) +(use-modules ((srfi srfi-1) #:select (first last remove second)) + ((srfi srfi-64) #:select (test-begin + test-end + test-equal)) + ((f) #:select (read-lines)) + ((algorithms) #:select (init sum))) (define (update-acc acc pwd size) (if (null? pwd) diff --git a/advent08.scm b/advent08.scm index f4c7539..bf7170b 100644 --- a/advent08.scm +++ b/advent08.scm @@ -1,11 +1,12 @@ #!/usr/bin/guile -s !# -(use-modules (srfi srfi-1) - (srfi srfi-64) - (ice-9 pretty-print) - ((f)) - ((algorithms))) +(use-modules ((srfi srfi-1) #:select (take take-right zip)) + ((srfi srfi-64) #:select (test-begin + test-end + test-equal)) + ((f) #:select (read-lines)) + ((algorithms) #:select (flatten product))) (define (char->number chr) (- (char->integer chr) 48)) -- 2.45.2