Created
November 10, 2017 15:51
-
-
Save mmar/63c7991738b06678e1bf9537e508967a to your computer and use it in GitHub Desktop.
Triangular numbers.
This file contains 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
let triangularNumbers = sequence(state: (0,0)) { (state: inout (Int,Int)) -> Int in | |
state = (state.0 + 1, state.1 + state.0 + 1 ) | |
return state.1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment