
Go语言
文章平均质量分 68
破小孩儿
互联网
系统分析师和软件架构师
设计模式 SOA 分布式
展开
-
[Go语言]我的第四个Go语言程序
Exercise: Fibonacci closure Let's have some fun with functions. Implement a fibonacci function that returns a function (a closure) that returns successive fibonacci numbers (0, 1, 1, 2, 3, 5,原创 2016-07-26 09:01:08 · 402 阅读 · 0 评论 -
[Go语言]我的第十个Go语言程序
Exercise: Equivalent Binary Trees There can be many different binary trees with the same sequence of values stored at the leaves. For example, here are two binary trees storing the sequence 1, 1, 2原创 2016-08-02 20:45:16 · 426 阅读 · 0 评论 -
[Go语言]我的第九个Go语言程序
Exercise: Images Remember the picture generator you wrote earlier? Let's write another one, but this time it will return an implementation of image.Image instead of a slice of data. Define you原创 2016-08-01 21:20:28 · 398 阅读 · 0 评论 -
[Go语言]我的第八个Go语言程序
Exercise: rot13Reader A common pattern is an io.Reader that wraps another io.Reader, modifying the stream in some way. For example, the gzip.NewReader function takes an io.Reader (a stream o原创 2016-08-01 21:04:24 · 451 阅读 · 0 评论 -
[Go语言]我的第七个Go语言程序
Exercise: Readers Implement a Reader type that emits an infinite stream of the ASCII character'A'. package main import "golang.org/x/tour/reader" type MyReader struct{} func (r MyReader) Read原创 2016-08-01 20:49:38 · 918 阅读 · 0 评论 -
[Go语言]我的第六个Go语言程序
Exercise: Errors Copy your Sqrt function from the earlier exercise and modify it to return an error value. Sqrt should return a non-nil error value when given a negative number, as it doesn't原创 2016-08-01 20:38:34 · 623 阅读 · 0 评论 -
[Go语言]我的第一个Go语言程序
Exercise: Loops and Functions As a simple way to play with functions and loops, implement the square root function using Newton's method. In this case, Newton's method is to approximate Sqrt(x)原创 2016-07-19 18:38:35 · 374 阅读 · 0 评论 -
[Go语言]我的第三个Go语言程序
Exercise: Maps Implement WordCount. It should return a map of the counts of each “word” in the string s. The wc.Test function runs a test suite against the provided function and prints success or原创 2016-07-21 18:38:05 · 326 阅读 · 0 评论 -
[Go语言]我的第二个Go语言程序
Exercise: Slices Implement Pic. It should return a slice of length dy, each element of which is a slice of dx 8-bit unsigned integers. When you run the program, it will display your picture, in原创 2016-07-21 18:07:20 · 346 阅读 · 0 评论 -
[Go语言]我的第五个Go语言程序
Exercise: Stringers Make the IPAddr type implementfmt.Stringer to print the address as a dotted quad. For instance, IPAddr{1, 2, 3, 4} should print as "1.2.3.4". package main import "fmt"原创 2016-07-31 09:55:19 · 692 阅读 · 0 评论 -
[Go语言]我的第十一个Go语言程序
Exercise: Web Crawler In this exercise you'll use Go's concurrency features to parallelize a web crawler. Modify the Crawl function to fetch URLs in parallel without fetching the same URL twice.原创 2016-08-02 21:24:08 · 377 阅读 · 0 评论