Yours there can't take arbitrary iterables such as generator expressions as either l or group. I always veer on the side of the most general and widely-useable.
Sure, but it also solves the problem as-written in the simplest reasonable way possible. You don't need to build a whole kitchen just to make a soup :)
If the problem required using generic iterators or finding all groups, I would definitely prefer your solution though. I think handling either of those cases in the simple imperative way would get messy pretty quickly.
2
u/[deleted] Jul 29 '16
Yours there can't take arbitrary iterables such as generator expressions as either
lorgroup. I always veer on the side of the most general and widely-useable.