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

main
Inga 🏳‍🌈 1 year ago
parent 4729fdbe40
commit 7ffb594999
  1. 39
      day05-hard/main.scm

@ -445,31 +445,33 @@
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")!#
(prepend '(0 4294967295 0))
(map (compose (list
;; for map line
create-map
(map (compose (list
;; for number in map line
string->number
list->string)))
(split (is #\space))
string->list
)))
#!(tee-with-comment "raw seed maps without prefix")!#
cdr))
raw-seed-maps)
(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
create-map
(map (compose (list
;; for number in map line
string->number
list->string)))
(split (is #\space))
string->list
)))
cdr)))
(define parse-initial
(compose (list
(map (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