-
Notifications
You must be signed in to change notification settings - Fork 545
Closed
Description
Hi,
I was recently working on the Fizzy exercise and it seems that the f64 and Fizzable test cases end up looping indefinitely on an iterator.
It looks like the problem is here:
let actual = fizz_buzz::<Fizzable>()
.apply(std::iter::successors(Some(Fizzable(1)), |prev| {
Some(*prev + 1.into())
}))
.take(16)
.collect::<Vec<_>>();
This seems to end up passing the whole, infinite, iterator to the apply method, before the take(16) , when it should probably pass only the taken elements, like this:
let actual = fizz_buzz::<Fizzable>()
.apply(std::iter::successors(Some(Fizzable(1)), |prev| {
Some(*prev + 1.into())
})
.take(16)
)
.collect::<Vec<_>>();
This ends up in a timeout in the f64 case and in an u8 overflow on the first Fizzable test case.

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels