A Tour of Go Exercise:Maps i 46 : function closure
摘要:
Implement afibonaccifunction that returns a function (a closure) that returns successive fibonacci numbers. 1 package main 2 3 import "fmt" 4 5 // fibonacci is a function that returns 6 // a function that returns an int. 7 func fibonacci() func() int { 8 i1 := 0 9 i2 := 110 return func... 阅读全文
posted @ 2012-04-29 00:46 Spray 阅读(355) 评论(0) 推荐(0) 编辑