Thread overview | |||||
---|---|---|---|---|---|
|
April 18, 2015 Why doesn't map!(a => writeln(a)) print anything? | ||||
---|---|---|---|---|
| ||||
Why can't I print things using the map algorithm? Specifically: http://ideone.com/VLp4Xa |
April 18, 2015 Re: Why doesn't map!(a => writeln(a)) print anything? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mark Isaacson | map evaluates its arguments on demand. Think of it as returning a function that does the work instead of actually doing the work - you still need to call that function, which happens when you loop over it. std.algorithm.each is more appropriate for acting now. |
April 18, 2015 Re: Why doesn't map!(a => writeln(a)) print anything? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Saturday, 18 April 2015 at 01:04:24 UTC, Adam D. Ruppe wrote:
> map evaluates its arguments on demand. Think of it as returning a function that does the work instead of actually doing the work - you still need to call that function, which happens when you loop over it.
>
> std.algorithm.each is more appropriate for acting now.
Ahhh.... cool. Thanks!
|
Copyright © 1999-2021 by the D Language Foundation