Parametric polymorphism: Difference between revisions

Better D entry
(D entry: updated and improved)
(Better D entry)
Line 224:
// Show the arrays of the whole tree.
//root.tmap(x => writefln("%(%.2f %)", x));
root.tmap((ref double[3] x) => writefln("%(%.2f %)", x));
 
// Modify the arrays of the whole tree.
//root.tmap((x){ x[] += 10; });
root.tmap((ref double[3] x){ x[] += 10; });
 
// Show the arrays of the whole tree again.
writeln();
//root.tmap(x => writefln("%(%.2f %)", x));
root.tmap((ref double[3] x) => writefln("%(%.2f %)", x));
}</lang>
{{out}}