Re:Falling in love with Rust
by staticassertion on Tuesday September 18, 2018 @09:38PM
(#18020963)
It's often idiomatic. I've never found it to be indecipherable at all. I actually find it to be quite readable in most contexts where intermediate variables are just noise.
Iterators are a typical example of this.
vec![0, 1, 2, 3].into_iter()
.filter(|x| x % 2 == 0) // Keep the evens
.map(|y| y + 1 ) // Add 1 to elements
.rev(); // Reverse the iterator
Adding intermediates would just add noise for code like this.
Iterators are a typical example of this.
vec![0, 1, 2, 3].into_iter() .filter(|x| x % 2 == 0) // Keep the evens .map(|y| y + 1 ) // Add 1 to elements .rev(); // Reverse the iterator
Adding intermediates would just add noise for code like this.