Closed xmartinez closed 6 years ago
I am not 100% sure that the proposed change is actually very idiomatic (I am still learning Rust), but I find the introduction of the new methods (map, product, ok) useful for learning the Result
and Iterator
traits.
BTW, thanks a lot for making this docs! I am finding them very helpful while getting familiar with Rust.
The Travis CI failure is unrelated to this pull request. It is timing out in the day20
program when fetching an external URL (http://pokeapi.co/api/v2/pokemon/111).
Closed/reopened PR to trigger CI builds again.
Awesome, thanks! I wrote this part before 1.0, when product()
was in an unstable MultiplicativeIterator
trait and hence I used fold()
here. But you're absolutely right about product()
being idiomatic Rust today.
Provide an alternative implementation for num_divisors that:
map
andproduct
from theIterator
trait (instead offold
),map
andok
from theResult
trait (instead of pattern matching onOk
andErr
).Also, update the included line ranges in day2.md accordingly (some of them were outdated).