]> git.lizzy.rs Git - rust.git/commit
Fix confusing doc for `scan`
authorSean Silva <chisophugis@gmail.com>
Sun, 25 Mar 2018 05:31:17 +0000 (22:31 -0700)
committerGitHub <noreply@github.com>
Sun, 25 Mar 2018 05:31:17 +0000 (22:31 -0700)
commitf198b0acf512458bdbe5079d12414ff94b03f7ac
tree45e7a07bdc3be59104368e740e928cbffc59c7d9
parente5bf0428d134e6f9c1fe54839f249c616b6b0b0b
Fix confusing doc for `scan`

The comment "the value passed on to the next iteration" confused me since it sounded more like what Haskell's [scanl](http://hackage.haskell.org/package/base-4.11.0.0/docs/Prelude.html#v:scanl) does where the closure's return value serves as both the "yielded value" *and* the new value of the "state".

I tried changing the example to make it clear that the closure's return value is decoupled from the state argument.
src/libcore/iter/iterator.rs