all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View file

@ -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*/ {
return m
.map!walkLength
.reduce!max
.iota
.map!(i => m.filter!(s => s.length > i).walkLength.repeat0);
}
auto beadSort(in uint[] data) /*pure nothrow*/ {
return data.map!repeat0.columns.columns.map!walkLength;
}
void main() {
[5, 3, 1, 7, 4, 1, 1].beadSort.writeln;
}