Skip to content

Commit 4ee21e3

Browse files
committed
minorly
1 parent 3810108 commit 4ee21e3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scheme/16/24.ss

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
(define hvac
55
(list->vector
66
(map (compose list->vector string->list)
7-
(parse-advent lines-raw ;; "small.in"
8-
))))
7+
(parse-advent lines-raw))))
98

109
(define R (vector-length hvac))
1110
(define C (vector-length (vector-ref hvac 0)))
@@ -19,6 +18,7 @@
1918
(nesw v)))
2019

2120
(define (init)
21+
(set! V '())
2222
(do ((i 0 (1+ i)))
2323
((= i R))
2424
(do ((j 0 (1+ j)))
@@ -41,16 +41,16 @@
4141
(define (dist u v)
4242
(let ((table (bfs-result-distances (cdr (assv u T)))))
4343
(hashtable-ref table v +inf.0)))
44-
(define (try-path vs d)
44+
(define (explore-path vs d)
4545
(match vs
46-
((u v vs ...) (try-path (cons v vs) (+ d (dist u v))))
46+
((u v vs ...) (explore-path (cons v vs) (+ d (dist u v))))
4747
(_ (when (< d best) (set! best d)))))
4848
(for-each (lambda (vs)
49-
(try-path (cons start vs) 0))
49+
(explore-path (cons start vs) 0))
5050
(permutations vertices))
5151
(format #t "part a: ~a~%" best)
5252
(set! best +inf.0)
5353
(for-each (lambda (vs)
54-
(try-path `(,start ,@vs ,start) 0))
54+
(explore-path `(,start ,@vs ,start) 0))
5555
(permutations vertices))
5656
(format #t "part b: ~a~%" best))

0 commit comments

Comments
 (0)