Skip to content

Instantly share code, notes, and snippets.

@mmar
Created November 9, 2017 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmar/5308116b30322acfbc59f4c4ce74ddc5 to your computer and use it in GitHub Desktop.
Save mmar/5308116b30322acfbc59f4c4ce74ddc5 to your computer and use it in GitHub Desktop.
The Fibonacci sequence.
let fibonacci = sequence(state: (0,1)) { (state: inout (Int,Int)) -> Int in
state = (state.1, state.0 + state.1)
return state.1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment