extracted parse-seed-maps out of seed-maps-processor

main
Inga 🏳‍🌈 12 months ago
parent 4729fdbe40
commit 7ffb594999
  1. 19
      day05-hard/main.scm

@ -445,15 +445,20 @@
flat
(map (apply-map-to-state-entry seed-map)))))
(define (seed-maps-processor raw-seed-maps)
(define (seed-maps-processor seed-maps)
(compose (list
;; for state
#!(tee-with-comment "state after applying mapset")!#
((compose (list
;; for list of map lines (within a single map set); should return state-transforming lambda
;; for list of maps (within a single map set); should return state-transforming lambda
compose
(map apply-map-to-state)
#!(tee-with-comment "current mapset")!#
(map apply-map-to-state)))
seed-maps)
swap-state)))
(define parse-seed-maps
(compose (list
;; for list of map lines (within a single map set)
(prepend '(0 4294967295 0))
(map (compose (list
;; for map line
@ -465,10 +470,7 @@
(split (is #\space))
string->list
)))
#!(tee-with-comment "raw seed maps without prefix")!#
cdr))
raw-seed-maps)
swap-state)))
cdr)))
(define parse-initial
(compose (list
@ -487,6 +489,7 @@
(((compose (list
compose
(map seed-maps-processor)
(map parse-seed-maps)
reverse
(filter is-not-empty)
(split (is ""))))

Loading…
Cancel
Save