gopl:K&D的Go编程语言练习的解决方案

  • e5_516861
    了解作者
  • 251.3KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-21 02:06
    上传日期
GOPL解决方案 Go编程语言中每项练习的解决方案。 许多练习都是基于书中的示例或较早的练习,并且我已根据需要复制了文件,因此每个练习都有一个单独的程序包。 如果我一直在想,我将一如既往地做出自己的承诺,那么使用git可以更轻松地了解我的起点。 既然如此,您将需要确定之前的示例或练习,并在5.6之后的练习中使用diff 。 有趣的练习 包装清单 :ex1.1打印命令行参数。 :ex1.2打印命令行索引和参数。 :ex1.3比较字符串连接技术。 ex1.4 :ex1.4打印在输入中出现多次的行数和文本。 ex1.5 :ex1.5生成带有随机绿色的调色板的Lissajous图形的GIF动画。 ex1.6 :ex1.6生成随机Lissajous图形的GIF动画,并在时间维度上应用了渐变。 ex1.7 :ex1.7将在每个指定URL处找到的内容流式传输到stdout。 ex1
gopl-master.zip
内容介绍
# GOPL solutions Solutions to every exercise in The Go Programming Language. Many of the exercises are based on an example from the book or an earlier exercise, and I've copied files as needed so there's a separate package for each exercise. If I'd been thinking I would have committed as I went so that it's easier to use git to see what I started from. As it is you'll need to determine the predecessor example or exercise and use `diff` for exercises after 5.6. ## Interesting exercises * [complex root visualization using Newton's method](ex3.7/main.go) * [CSS-style selector for XML](ex7.17/main.go) * [RFC959-compliant FTP server](ex8.2/ftpd.go) * [du clone](ex8.9/main.go) * [web mirroring tool](ex8.10/mirror.go) * [chat server](ex8.15/chat.go) * [cancellable function memoization](ex9.3/memo.go) * [archive reader](ex10.2/arprint.go) * [go package ancestor tool](ex10.4/ancestors.go) * [generate random non-palindromes using a grammar](ex11.3/palindrome_test.go) ## Package list * [ex1.1](ex1.1): ex1.1 prints command line arguments. * [ex1.2](ex1.2): ex1.2 prints commandline indexes and arguments. * [ex1.3](ex1.3): ex1.3 compares string concatenation techniques. * [ex1.4](ex1.4): ex1.4 prints the count and text of lines that appear more than once in the input. * [ex1.5](ex1.5): ex1.5 generates GIF animations of random Lissajous figures, with a green-on-black palette. * [ex1.6](ex1.6): ex1.6 generates GIF animations of random Lissajous figures, with a gradient applied on the time dimension. * [ex1.7](ex1.7): ex1.7 streams the content found at each specified URL to stdout. * [ex1.8](ex1.8): ex1.8 streams the content found at each specified URL to stdout, and appends http:// to arguments as needed. * [ex1.9](ex1.9): ex1.9 streams the content found at each specified URL to stdout and prints the HTTP status code. * [ex1.10](ex1.10): ex1.10 fetches URLs in parallel and reports their times and sizes. * [ex1.12](ex1.12): ex1.6 generates GIF animations of random Lissajous figures, with a gradient applied on the time dimension and the number of cycles to display can be supplied in the url query string when running as a web server. * [ex2.1](ex2.1): ex2.1 performs Celsius, Fahrenheit, and Kelvin conversions. * [ex2.2](ex2.2): ex2.2 prints measumrents given on the command line or stdin in various units. * [ex2.3](ex2.3): ex2.3: compare popcount implementations: looping and single-expression bytewise table lookups. * [ex2.4](ex2.4): ex2.4: compare popcount implementations, including looping table lookups and shift value. * [ex2.5](ex2.5): ex2.4: compare popcount implementations, including clear rightmost. * [ex3.1](ex3.1): ex3.1 prints an svg image, ignoring non-finite vertexes. * [ex3.2](ex3.2): ex3.2 prints an SVG rendering of an eggbox or saddle. * [ex3.3](ex3.3): ex3.3 prints an svg image, coloring its vertices based on their height. * [ex3.4](ex3.4): ex3.4 serves SVG rendering of a 3-D surface function over http. * [ex3.5](ex3.5): ex3.5 emits a full-color PNG image of the Mandelbrot fractal. * [ex3.6](ex3.6): ex3.5 emits a supersampled image of the Mandelbrot fractal. * [ex3.7](ex3.7): ex3.7 visualizes how many iterations it takes to find complex roots of a quartic equation using Newton's method, using different colors for different roots. * [ex3.8](ex3.8): ex3.8 compares different numeric types when rendering fractals. * [ex3.9](ex3.9): ex3.9 serves images of fractals over http. * [ex3.10](ex3.10): ex3.10 inserts commas into integer strings given as command-line arguments, without using recursion. * [ex3.11](ex3.11): ex3.11 inserts commas into floating point strings with an optional sign, given as command-line arguments. * [ex3.12](ex3.12): ex3.12 determines if strings are anagrams of each other. * [ex3.13](ex3.13): ex3.13 is a short definition of byte unit constants. * [ex4.1](ex4.1): ex4.1 computes the number of bits different between two hashes. * [ex4.2](ex4.2): ex4.2 prints the SHA hash of stdin. * [ex4.3](ex4.3): ex4.3 reverses an array * [ex4.4](ex4.4): ex4.4 rotates a slice of ints by one position to the left. * [ex4.5](ex4.5): ex4.5 dedupes a slice of strings. * [ex4.6](ex4.6): ex4.6 reverses a utf8 string. * [ex4.7](ex4.7): ex4.7 reverses a utf8 string in-place. * [ex4.8](ex4.8): ex4.8 computes counts of Unicode characters. * [ex4.9](ex4.9): ex4.9 counts word frequency for stdin. * [ex4.10](ex4.10): ex4.10 prints a table of GitHub issues matching the search terms, organized by the past day, month, and year. * [ex4.11](ex4.11): Package github provides a Go API for the GitHub issue tracker. * [ex4.12](ex4.12): ex4.12 gets, indexes, and searches xkcd comic metadata. * [ex4.13](ex4.13): ex4.13 searches OMDB by title and downloads a movie poster. * [ex4.14](ex4.14): Package github provides a Go API for the GitHub issue tracker. * [ex5.1](ex5.1): ex5.1 prints the links in an HTML document read from standard input. * [ex5.2](ex5.2): ex5.2 counts the frequency of different tags in an html document on stdin. * [ex5.3](ex5.3): ex5.3 prints nonempty text tokens from an html document on stdin. * [ex5.4](ex5.4): ex5.4 prints the links in an HTML document read from standard input, including those for images, scripts, and style sheets. * [ex5.5](ex5.5): ex5.5 counts the number of words and images at a url. * [ex5.6](ex5.6): ex5.6 computes an SVG rendering of a 3-D surface function, using a bare return statement. * [ex5.7](ex5.7): ex5.7 pretty-prints html. * [ex5.8](ex5.8): ex5.8 finds an html element node by id attribute. * [ex5.9](ex5.9): ex5.9 expands shell-style variable references on stdin. * [ex5.10](ex5.10): ex5.10 sorts courses topologically based on hard-coded dependencies. * [ex5.11](ex5.11): ex5.11 reports on cycles in course dependencies. * [ex5.12](ex5.12): ex5.12 prints the outline of an HTML document tree. * [ex5.13](ex5.13): ex5.13 saves a local mirror of a website. * [ex5.14](ex5.14): ex5.14 prints a random course's prerequisites, recursively. * [ex5.15](ex5.15): ex5.15 explores variadic min and max functions. * [ex5.16](ex5.16): ex5.16 provides a variadic string-joining function. * [ex5.17](ex5.17): ex5.17 uses a variadic ElementsByTagName function to find html nodes. * [ex5.18](ex5.18): ex5.18 saves the contents of a URL to a local file. * [ex5.19](ex5.19): ex5.19 returns a non-zero value using panic and recover, contradicting the function signature. * [ex6.1](ex6.1): ex6.1 is a bit vector integer set. * [ex6.2](ex6.2): ex6.2 is a integer set with a variadic AddAll method. * [ex6.3](ex6.3): ex6.3 is a bit vector integer set with binary set operations. * [ex6.4](ex6.4): ex6.4 is an integer set with an Elems method. * [ex6.5](ex6.5): ex6.5 is a variable-word-size bit vector intset. * [ex7.1](ex7.1): ex7.1 provides line and word counters. * [ex7.2](ex7.2): ex7.2 wraps a writer to count written words. * [ex7.3](ex7.3): ex7.3 provides insertion sort using an unbalanced binary tree, and a String method to visualize the tree. * [ex7.4](ex7.4): ex7.4 provides a simple string reader. * [ex7.5](ex7.5): ex7.5 provides a LimitReader that reports EOF at a given offset. * [ex7.6](ex7.6): ex7.6 prints flag arguments for different temperature scales, including Kelvin. * [ex7.8](ex7.8): ex7.8 provides iterative columnar sorting for Persons. * [ex7.9](ex7.9): ex7.9 serves an html table with a stable column sort. * [ex7.10](ex7.10): ex7.10 uses sort.Interface to detect palindromes. * [ex7.11](ex7.11): ex7.11 adds CRUD http endpoints to a simple PriceDB server. * [ex7.12](ex7.12): ex7.12 convert's PriceDB list output to an html table. * [ex7.13](ex7.13): ex7.13 adds pretty-printing to an arithmetic expression parser. * [ex7.14](ex7.14): ex7.14 adds factorials to an arithmetic expression parser. * [ex7.15](ex7.15): ex7.15 evaluates an expression using given variable bindings. * [ex7.16](ex7.16): ex7.16 is a web-based calculator. * [ex7.17](ex7.17): ex7.17 provides CSS-style selectors for XML. * [ex7.18](ex7.18): ex7.18 parses XML into a tree of nodes, using the to
评论
    相关推荐
    • 第1课 Scratch初体验 课件+教案+教学视频+源代码.zip
      Scratch初体验 课件+教案+教学视频+源代码 ,Scratch是一种编程语言和在线社区,孩子们可以在这里与来自世界各地的人们一起编程和分享故事,游戏和动画等互动媒体。当孩子们用Scratch创造时,他们学会创造性思考,...
    • Go语言圣经
      Go语言是谷歌推出的一种全新的C语言风格的编程语言,可以在不损失应用程序性能的情况下降低代码的复杂性,提高编程效率,适合开发大型软件,有望成为主流的编程语言。(方便自己后期学习上传)
    • html-nopl:HTML是一种编程语言吗?
      HTML是一种编程语言吗? 和源代码。 这是带有HTML和CSS的简单动画
    • 编程动画素材
      编程动画素材gis和avi有40多个,给开发进度条动画显示提供帮助
    • Simple-GUI-Java-Calculator:简单的计算器是用Java编程语言编写的
      简单的计算器是用Java编程语言编写的。 Basit hesap makinesi Java programlama dilinde yazılmıştır. 功能 Kullanıcıların kullanabileceği arayüze sahip hesap makinası 怎么跑 下载资料库运行文件...
    • cpp-V语言中文主页
      V语言是为开发可维护的软件而创建的简单、快速、安全的编程语言
    • Ruby编程语言(The Ruby Programming Language)
      本书详细介绍了Ruby1.8和1.9版本各方面的内容。在对Ruby进行了简要的综述之后,本书详细介绍了以下内容:Ruby的句法和语法结构,数据结构和对象,表达式和操作符,语句和控制结构,方法、proc、lambda和闭包,反射...
    • Ruby编程语言
      《Ruby编程语言》详细介绍了Ruby1.8和1.9版本各方面的内容。在对Ruby进行了简要的综述之后,《Ruby编程语言》详细介绍了以下内容:Ruby的句法和语法结构,数据结构和对象,表达式和操作符,语句和控制结构,方法、...
    • code101:用于查询编程语言命令的渐进式Web应用程序
      用于查询编程语言命令的渐进式Web应用程序 关于 正如许多人认为的那样,有时编程可能是一项艰巨的任务,这是大多数程序员每天都必须面对的一些挑战: 数小时阅读文档 试图了解无法理解的错误消息 在上搜索常见的...
    • GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
      guassdb100在redhat上安装包,单机部署的包,安装步骤请看我的文中介绍,经过大量实验搭建总结出来的文档