On Friday, 2 August 2019 at 21:44:28 UTC, Jordan Wilson wrote:
Hello,
I don't quite understand why isEven is called twice in the 2nd
example?
auto isEven(int n) {
n.writeln;
return (n % 2) == 0;
}
void main() {
auto z = [1,2,3];
// outputs 1 2 3
On Friday, 2 August 2019 at 21:44:28 UTC, Jordan Wilson wrote:
Hello,
I don't quite understand why isEven is called twice in the 2nd
example?
auto isEven(int n) {
n.writeln;
return (n % 2) == 0;
}
void main() {
auto z = [1,2,3];
// outputs 1 2 3
On Friday, 2 August 2019 at 22:35:53 UTC, Adam D. Ruppe wrote:
On Friday, 2 August 2019 at 21:44:28 UTC, Jordan Wilson wrote:
// outputs 1 2 2 3
z.map!(a => tuple!("number","iseven")(a, a.isEven))
.filter!(a => a.iseven)
.array;
I *think* what's happening here
On Friday, 2 August 2019 at 21:44:28 UTC, Jordan Wilson wrote:
// outputs 1 2 2 3
z.map!(a => tuple!("number","iseven")(a, a.isEven))
.filter!(a => a.iseven)
.array;
I *think* what's happening here is first it calls map() first
going into the filter... then it
Hello,
I don't quite understand why isEven is called twice in the 2nd
example?
auto isEven(int n) {
n.writeln;
return (n % 2) == 0;
}
void main() {
auto z = [1,2,3];
// outputs 1 2 3
z.map!(a => tuple!("number")(a))
.filter!(a => a.nu