This one weird trick allows you to capture loop variables.
Ali Çehreli
acehreli at yahoo.com
Tue Nov 19 16:43:47 UTC 2024
On 10/20/24 8:41 PM, Walter Bright wrote:
> That's because you're smarter than I am, Timon. And I'm not joking.
I am happy to be smart enough to see that you are right. :o)
> I implemented it as a way to deal with visiting each node of a binary
> tree. Doing that with a range is clunky and unappealing.
Exactly! I've always thought opApply is one of the most brilliant parts
of D. It's easy to see the curly braces of the foreach loop as a lambda
anyway.
Ali
More information about the Digitalmars-d
mailing list