Skip to content

Instantly share code, notes, and snippets.

View shisama's full-sized avatar

Masashi Hirano shisama

View GitHub Profile
@shisama
shisama / CodePiece.swift
Last active January 15, 2018 16:17 — forked from es-kumagai/CodePiece.swift
Swiftでは++が使えないので、その代わりにcount変数をカウントアップする関数で代用 #minna_de_swift
let fibonacci = sequence(state: (current: 0, next: 1)) { state -> Int in
defer {
state = (current: state.next, next: state.current + state.next)
}
return state.current
}
let values = Array(fibonacci.prefix(13))
var count = 0