Programmer Spray, on duty

Game, UnrealEngine3

导航

04 2012 档案

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 阅读(364) 评论(0) 推荐(0)

A Tour of Go Exercise:Maps i 44
摘要:Go 语言练习 A Tour of GoImplementWordCount. It should return a map of the counts of each “word” in the strings. Thewc.Testfunction runs a test suite against the provided function and prints success or failure.You might findstrings.Fieldshelpful. 1 package main 2 3 import ( 4 "tour/wc" 5 " 阅读全文

posted @ 2012-04-28 23:33 Spray 阅读(256) 评论(0) 推荐(0)