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
On 2015-02-10 at 01:41, bearophile wrote:
auto query = iota(2, 12)
.map!(c = Tuple!(int,length, int,height,
int,hypotenuse)
(2 * c, c ^^ 2 - 1, c ^^ 2 + 1))
.map!(x = %3d%4d%4d.format(x.height, x.hypotenuse,
On Tuesday, 10 February 2015 at 01:31:54 UTC, FG wrote:
On 2015-02-10 at 01:41, bearophile wrote:
auto query = iota(2, 12)
.map!(c = Tuple!(int,length, int,height,
int,hypotenuse)
(2 * c, c ^^ 2 - 1, c ^^ 2 +
1))
.map!(x
Dennis Ritchie:
Tell me, please, how to write similar С# code D:
This is more or less exactly the same:
void main() {
import std.stdio, std.range, std.algorithm, std.typecons,
std.format;
auto query = iota(2, 12)
.map!(c = Tuple!(int,length, int,height,
int
Tell me, please, how to write similar С# code D:
using System;
using System.Linq;
public class Test
{
public static void Main()
{
var query = Enumerable.Range(2, 10)
.Select(c = new { Length = 2 * c, Height = c * c - 1,
Hypotenuse = c * c + 1 })
.Select(x