File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 4
4
(define hvac
5
5
(list->vector
6
6
(map (compose list->vector string->list)
7
- (parse-advent lines-raw ; ; "small.in"
8
- ))))
7
+ (parse-advent lines-raw))))
9
8
10
9
(define R (vector-length hvac))
11
10
(define C (vector-length (vector-ref hvac 0 )))
19
18
(nesw v)))
20
19
21
20
(define (init )
21
+ (set! V '() )
22
22
(do ((i 0 (1+ i)))
23
23
((= i R))
24
24
(do ((j 0 (1+ j)))
41
41
(define (dist u v )
42
42
(let ((table (bfs-result-distances (cdr (assv u T)))))
43
43
(hashtable-ref table v +inf.0)))
44
- (define (try -path vs d )
44
+ (define (explore -path vs d )
45
45
(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))))
47
47
(_ (when (< d best) (set! best d)))))
48
48
(for-each (lambda (vs )
49
- (try -path (cons start vs) 0 ))
49
+ (explore -path (cons start vs) 0 ))
50
50
(permutations vertices))
51
51
(format #t " part a: ~a~%" best)
52
52
(set! best +inf.0)
53
53
(for-each (lambda (vs )
54
- (try -path `(,start ,@vs ,start) 0 ))
54
+ (explore -path `(,start ,@vs ,start) 0 ))
55
55
(permutations vertices))
56
56
(format #t " part b: ~a~%" best))
You can’t perform that action at this time.
0 commit comments