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,14 @@
fcn mergeStreams(s1,s2,etc){ //-->Walker
streams:=vm.arglist.pump(List(),fcn(s){ // prime and prune
if( (w:=s.walker())._next() ) return(w);
Void.Skip // stream is dry
});
Walker().tweak(fcn(streams){
if(not streams) return(Void.Stop); // all streams are dry
values:=streams.apply("value"); // head of the streams
v:=values.reduce('wrap(min,x){ if(min<=x) min else x });
n:=values.find(v); w:=streams[n]; w._next(); // read next value from min stream
if(w.atEnd) streams.del(n); // prune empty streams
v
}.fp(streams));
}

View file

@ -0,0 +1,2 @@
w:=mergeStreams([0..],[2..*,2],[3..*,3],T(5));
w.walk(20).println();

View file

@ -0,0 +1,2 @@
w:=mergeStreams(File("unixdict.txt"),File("2hkprimes.txt"),File("/dev/null"));
do(10){ w.read().print() }

View file

@ -0,0 +1,2 @@
mergeStreams(File("unixdict.txt"),File("2hkprimes.txt"),File("/dev/null"))
.pump(File("foo.txt","w"));