To write such an expressive code D

Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 9 23:01:53 PST 2015


On Tuesday, 10 February 2015 at 06:17:17 UTC, Ali Çehreli wrote:
> 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
Thank you.


More information about the Digitalmars-d-learn mailing list