How to write similar code D?
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Feb 10 00:03:19 PST 2015
FG:
> auto query = iota(2, 2 + 10)
> .map!(c => ["Length": 2 * c, "Height": c * c - 1,
> "Hypotenuse": c * c + 1])
> .map!(x => format("%4d%4d%4d", x["Height"],
Unlike other languages like JavaScript, the D front-end is very
weak in optimizing well such kind of code... I think D compilers
handle built-in associative arrays in a very straight way.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list