Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
extension SequenceType where Generator.Element: SequenceType {
func transposeAndPad() -> [[Generator.Element.Generator.Element]]? {
var g = self.generate()
return {
var gens = GeneratorSequence(g).map{$0.generate()}
return $ { fEl in [fEl] +{gens[$0].next() ?? fEl}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.