std.algorithm have two function for iteration map
and each
. I can't understand what is the difference?
each
performs an eager evaluation, while map
performs a lazy one.
This means that when you apply each
, every element is calculated immediately, while map
calculates its results only when you access them.
This also means that each
is unsuitable for infinite streams.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With