To write such an expressive code D
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Feb 9 22:17:16 PST 2015
On 02/09/2015 08:17 PM, Dennis Ritchie wrote:
> Ali, and you can write it without using the function "iota()" and map?
No because the a..b syntax is not a D language construct that we can use
anywhere that it makes sense. It only works as number ranges inside
foreach loops, when indexing slices, and case value ranges.
Also no, because there is no equivalent of F#'s -> syntax, we have to
use map.
> "%(%.15g\n%)".writefln(iota(0, PI/2, PI/2/9).map!sin);
>
> I just need that code was only used features of the language without
> using library functions. You may only use the function sin().
I am waiting to see a language solution that does not use even sin(). :o)
Ali
More information about the Digitalmars-d-learn
mailing list