The Go Programming Language Ex

The Go Programming Language Ex(11)

Ex 9.1 Add a function Withdraw(amount int) bool to the gopl.io/ch9/bank1 program. The result should indicate whether the transaction succeeded or failed due to insufficient funds. The message sent to the monitor goroutine must contain both the amount to withdraw and a new channel over which the monitor goroutine can send the boolean result back to Withdraw.

The Go Programming Language Ex(10)

Ex 8.6 Add depth-limiting to the concurrent crawler. That is, if the user sets -depth=3, then only URLs reachable by at most three links will be fetched.

The Go Programming Language Ex(9)

Ex 8.1 Modify clock2 to accept a port number, and write a program, clockwall, that acts as a client of several clock servers at once, reading the times from each one and displaying the results in a table, akin to the wall of clocks seen in some business offices. If you have access to geographically distributed computers, run instances remotely ; otherwise run local instances on different ports with fake time zones.

The Go Programming Language Ex(8)

Ex 7.1 Using the ideas from ByteCounter, implement counters for words and for lines. You will find bufio.ScanWords useful.

The Go Programming Language Ex(7)

Ex 6.1 Implement these additional methods: func (*IntSet) Len() int // return the number of elements func (*IntSet) Remove(x int) //remove x from the set func (*IntSet) Clear() // remove all elements from the set func (*IntSet) Copy() *IntSet // return a copy of the set

The Go Programming Language Ex(6)

Ex 5.1 Change the findlinks program to traverse the n.FirstChild linked list using recursive calls to visit instead of a loop.

The Go Programming Language Ex(5)

Ex 4.8 Modify charcount to count letters, digits, and so on in their Unicode categories, using functions like unicode.IsLetter.

The Go Programming Language Ex(4)

Ex 4.1 Write a function that counts the number of bits that are different in two SHA256 hashes. (See PopCount from Section 2.6.2.)

The Go Programming Language Ex(3)

Ex 3.10 Write a non-recursive version of comma, using bytes.Buffer instead of str concatenation.

The Go Programming Language Ex(2)

Ex 2.1 Add types, constants, and functions to tempconv for processing temperatures in the Kelvin scale, where zero Kelvin is −273.15°C and a difference of 1K has the same magnitude as 1°C.