Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
import std.stdio, std.algorithm, std.range, std.array, std.functional;
|
||||
|
||||
alias repeat0 = curry!(repeat, 0);
|
||||
|
||||
// Currenty std.range.transposed doesn't work.
|
||||
auto columns(R)(R m) pure /*nothrow*/ @safe /*@nogc*/ {
|
||||
return m
|
||||
.map!walkLength
|
||||
.reduce!max
|
||||
.iota
|
||||
.map!(i => m.filter!(s => s.length > i).walkLength.repeat0);
|
||||
}
|
||||
|
||||
auto beadSort(in uint[] data) pure /*nothrow @nogc*/ {
|
||||
return data.map!repeat0.columns.columns.map!walkLength;
|
||||
}
|
||||
|
||||
void main() {
|
||||
[5, 3, 1, 7, 4, 1, 1].beadSort.writeln;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue