Last active
October 20, 2015 13:44
-
-
Save mickmaccallum/2cfefd3f610a703cb59d to your computer and use it in GitHub Desktop.
Revisions
-
0x7FFFFFFF revised this gist
Oct 20, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,7 @@ struct FizzBuzzGenerator: SequenceType { } } let fizzBuzzSequence = FizzBuzzGenerator(bounds: 1...100).lazy for x in fizzBuzzSequence { print(x) } -
0x7FFFFFFF revised this gist
Jul 31, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ struct FizzBuzzGenerator: SequenceType { private let bounds: Range<Int> func generate() -> AnyGenerator<String> { var current = bounds.startIndex -
0x7FFFFFFF revised this gist
Jul 31, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,7 @@ struct FizzBuzzGenerator: SequenceType { } } let fizzBuzzSequence = lazy(FizzBuzzGenerator(bounds: 1...100)) for x in fizzBuzzSequence { print(x) } -
0x7FFFFFFF revised this gist
Jul 31, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,7 @@ struct FizzBuzzGenerator: SequenceType { } } let fizzBuzzSequence = FizzBuzzGenerator(bounds: 1...100) for x in fizzBuzzSequence { print(x) } -
0x7FFFFFFF created this gist
Jul 31, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ struct FizzBuzzGenerator: SequenceType { private var bounds: Range<Int> func generate() -> AnyGenerator<String> { var current = bounds.startIndex return anyGenerator { guard current < self.bounds.endIndex else { return nil } let output: String switch (current % 3, current % 5) { case (0, 0): output = "FizzBuzz" case (0, _): output = "Fizz" case (_, 0): output = "Buzz" default: output = String(current) } current++ return output } } } let fizzBuzzSequence = FizzBuzzGenerator(bounds: 1...1000) for x in fizzBuzzSequence { print(x) }