So much D in my life

This commit is contained in:
NickPapanastasiou 2015-06-10 14:13:38 -04:00
parent 455875cd91
commit f30876d3f6

View File

@ -205,6 +205,7 @@ void main() {
// from 1 to 100. Easy! // from 1 to 100. Easy!
// Just pass lambda expressions as template parameters! // Just pass lambda expressions as template parameters!
// You can pass any old function you like, but lambdas are convenient here.
auto num = iota(1, 101).filter!(x => x % 2 == 0) auto num = iota(1, 101).filter!(x => x % 2 == 0)
.map!(y => y ^^ 2) .map!(y => y ^^ 2)
.reduce!((a, b) => a + b); .reduce!((a, b) => a + b);