Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,12 +1,12 @@
import std.stdio;
T[] forwardDifference(T)(T[] s, in int n) pure {
foreach (_; 0 .. n)
s[] -= s[1 .. $];
T[] forwardDifference(T)(T[] s, in int n) pure nothrow @nogc {
foreach (immutable i; 0 .. n)
s[0 .. $ - i - 1] = s[1 .. $ - i] - s[0 .. $ - i - 1];
return s[0 .. $ - n];
}
void main() {
immutable A = [90.5, 47, 58, 29, 22, 32, 55, 5, 55, 73.5];
foreach (level; 0 .. A.length)
writeln(forwardDifference(A.dup, level));
foreach (immutable level; 0 .. A.length)
forwardDifference(A.dup, level).writeln;
}