Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,15 @@
func merge_streams(streams) {
var s = streams.map { |stream|
Pair(stream, stream.readline)
}.grep {|p| defined(p.value) }
gather {
while (s) {
var p = s.min_by { .value }
take(p.value)
p.value = (p.key.readline \\ s.delete_if { _ == p })
}
}
}
say merge_streams(ARGV.map {|f| File(f).open_r }).join("\n")