[2023][ruby][5.x] remove duplicate code

main
Alpha Chen 1 year ago
parent 1815ec7b1a
commit 5525e8b7e5
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -81,23 +81,6 @@ p dests.map(&:begin).min
# }
# .min
# seeds = seeds
# .each_slice(2)
# .map {|start, length| (start...start+length) }
# reversed = mappings
# .map {|mapping|
# Mapping.new(
# mapping.conversions.map {|c|
# Conversion.new((c.dest_start...c.dest_start+c.source_range.size), c.source_range.begin)
# }
# )
# }
# .reverse
# p (0..).find {|i|
# source = reversed.inject(i) {|cur, mapping| mapping[cur] }
# seeds.any? { _1.cover?(source) }
# }
# seeds = seeds
# .each_slice(2)
# .map {|start, length| (start...start+length) }
@ -110,6 +93,14 @@ reversed = mappings
)
}
.reverse
# p (0..).find {|i|
# source = reversed.inject(i) {|cur, mapping| mapping[cur] }
# seeds.any? { _1.cover?(source) }
# }
# seeds = seeds
# .each_slice(2)
# .map {|start, length| (start...start+length) }
lowest = seeds
.flat_map(&:minmax)
.filter_map {|seed|

Loading…
Cancel
Save