M advent01.scm => advent01.scm +6 -5
@@ 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))))
M advent02.scm => advent02.scm +6 -4
@@ 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))))
M advent03.scm => advent03.scm +6 -4
@@ 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)))
M advent04.scm => advent04.scm +5 -4
@@ 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 #\,)))
M advent05.scm => advent05.scm +12 -4
@@ 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
M advent06.scm => advent06.scm +5 -4
@@ 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)
M advent07.scm => advent07.scm +6 -4
@@ 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)
M advent08.scm => advent08.scm +6 -5
@@ 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))