inlined apply-map-xxx

main
Inga 🏳‍🌈 12 months ago
parent 7ffb594999
commit 3a601818ad
  1. 25
      day05-hard/main.scm

@ -433,26 +433,23 @@
(get-range-start state-value)
(get-range-end state-value)))
(define (apply-map-to-state-entry seed-map)
(lambda (state-entry)
(if
(is-state-value-current state-entry)
(list state-entry)
(apply-map-to-previous-state-value seed-map (get-state-value state-entry)))))
(define (apply-map-to-state seed-map)
(compose (list
flat
(map (apply-map-to-state-entry seed-map)))))
(define (seed-maps-processor seed-maps)
(compose (list
;; for state
#!(tee-with-comment "state after applying mapset")!#
((compose (list
;; for list of maps (within a single map set); should return state-transforming lambda
;; for list of maps (within a single map set); returns state-transforming lambda
compose
(map apply-map-to-state)))
(map (lambda (seed-map)
;; for seed map within the list: returns state-transforming lambda
(compose (list
flat
(map (lambda (state-entry)
;; for seed map _and_ single range from state, returns list of new ranges
(if
(is-state-value-current state-entry)
(list state-entry)
(apply-map-to-previous-state-value seed-map (get-state-value state-entry)))))))))))
seed-maps)
swap-state)))

Loading…
Cancel
Save