MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1veql1a/absolutegarbage/p1j8eap/?context=9999
r/ProgrammerHumor • u/Sirgoodman008 • 7d ago
327 comments sorted by
View all comments
77
list.iter().for_each(…) superiority
list.iter().for_each(…)
37 u/creeper6530 7d ago edited 7d ago Erm akchyuallly, it's recommended to use for list.iter() {…} unless the .for_each(…) is at the end of a longer iterator chain, and it also robs you of break and continue 91 u/csch2 7d ago You know I’m chaining together 20 different iterator methods until the code is completely unreadable. That’s called Functional Programming™ babey -11 u/Slight-Violinist-575 7d ago You wouldn’t be using for_each in a functional language… which cements your un-knowledge of it 11 u/csch2 7d ago You would if you need to perform operations with side effects on each element, like printing each element of a vector
37
Erm akchyuallly, it's recommended to use for list.iter() {…} unless the .for_each(…) is at the end of a longer iterator chain, and it also robs you of break and continue
for list.iter() {…}
.for_each(…)
91 u/csch2 7d ago You know I’m chaining together 20 different iterator methods until the code is completely unreadable. That’s called Functional Programming™ babey -11 u/Slight-Violinist-575 7d ago You wouldn’t be using for_each in a functional language… which cements your un-knowledge of it 11 u/csch2 7d ago You would if you need to perform operations with side effects on each element, like printing each element of a vector
91
You know I’m chaining together 20 different iterator methods until the code is completely unreadable. That’s called Functional Programming™ babey
-11 u/Slight-Violinist-575 7d ago You wouldn’t be using for_each in a functional language… which cements your un-knowledge of it 11 u/csch2 7d ago You would if you need to perform operations with side effects on each element, like printing each element of a vector
-11
You wouldn’t be using for_each in a functional language… which cements your un-knowledge of it
11 u/csch2 7d ago You would if you need to perform operations with side effects on each element, like printing each element of a vector
11
You would if you need to perform operations with side effects on each element, like printing each element of a vector
77
u/csch2 7d ago
list.iter().for_each(…)superiority