Add sequence assertion to generate_sequence
Changed generate to use a stateful functor