Skip to content

Instantly share code, notes, and snippets.

@dorkalev
Created February 11, 2014 04:50
Show Gist options
  • Save dorkalev/8929443 to your computer and use it in GitHub Desktop.
Save dorkalev/8929443 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func fibonaci(l uint) uint {
var fibo func(arr []uint, l uint) uint
var ret uint
fibo = func(arr []uint, l uint) uint {
if l > 2 {
ret = fibo([]uint{arr[1], (arr[0] + arr[1])}, l-1)
} else {
ret = arr[1]
}
return ret
}
return fibo([]uint{1, 1}, l)
}
func main() {
fmt.Println(fibonaci(8))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment