2017-08-21
The Lear Siegler ADM-3A terminal is a very important artefact in computing history. If you want to know why your shell abbreviates $HOME to ~, it’s because of the label on the ~ key on the ADM-3A. If you want to know why hjkl are the de facto cursor keys in vi, look at the symbols above the […]
2017-08-20
This is an experience report about the use of, and difficulties with, the context.Context facility in Go. Many authors, including myself, have written about the use of, misuse of, and how they would change, context.Context in a future iteration of Go. While opinions differs on many aspects of context.Context, one thing is clear–there is almost unanimous agreement that […]
2017-08-18
Go by Example Example It has it package main import "fmt" // Go supports methods defined on struct types. type rect struct { width, height int } // This area method has a receiver type of *rect. func (r *rect) area() int { return r.width * r.height } // Methods can be defined for either … Continue reading "(Go Lang) Methods (GBEN)"
2017-08-18
Go by Example Example Like in C package main import "fmt" // Go’s structs are typed collections of fields. They’re useful for grouping // data together to form records. // This person struct type has name and age fields. type person struct { name string age int } func main() { // This syntax creates … Continue reading "(Go Lang) Structs (GBEN)"
2017-08-18
Go by Example Example Like in C package main import "fmt" // We’ll show how pointers work in contrast to values with 2 functions: // zeroval and zeroptr. zeroval has an int parameter, so arguments will be // passed to it by value. zeroval will get a copy of ival distinct from the // one … Continue reading "(Go Lang) Pointers (GBEN)"
2017-08-18
Go by Example Example It has it package main import "fmt" // This fact function calls itself until it reaches the base case of fact(0). func fact(n int) int { if n == 0 { return 1 } return n * fact(n-1) } func main() { fmt.Println(fact(7)) } 5040 Attribution
2017-08-18
Go by Example Example Like in Lisp Don’t allow recursion against themselves // Go supports anonymous functions, which can form closures. Anonymous // functions are useful when you want to define a function inline without // having to name it. // This function intSeq returns another function, which we define anonymously // in the body … Continue reading "(Go Lang) Closures (GBEN)"