Created
June 25, 2016 13:32
-
-
Save InsertNetan/9d9cee6c8759c0872836ac0151cf625d to your computer and use it in GitHub Desktop.
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 characters
// same as scanl but without initial | |
extension Array { | |
func scanl(combine: (Element, Element) -> Element) -> [Element] { | |
guard let first = self.first else { return [] } | |
return Array(self.dropFirst()).scanl(initial:first, combine:combine) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment