To write such an expressive code D

Tobias Pankrath via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 9 11:45:00 PST 2015


On Monday, 9 February 2015 at 19:40:42 UTC, Dennis Ritchie wrote:
> Good evening.
> Is it possible to D something to replace the container on the 
> F#, which displays the values of the sine from 0 to 90 degrees 
> with an interval of 10 degrees:
> let pi = Math.PI
> let sins = [for x in 0.0..pi / 2.0 / 9.0..pi / 2.0 -> sin x]
> sins.Dump()
>
> Output:
> 0
> 0,17364817766693
> 0,342020143325699
> 0,5
> 0,642787609686539
> 0,766044443118978
> 0,866025403784439
> 0,939692620785908
> 0,984807753012208
> 1
>
> P.S. Interested in code that will be as impressive as this. In 
> General, I would like to see something akin to D.

iota(0, 91, 10).map!sin.writeln

or something like that.


More information about the Digitalmars-d-learn mailing list