1.5 KiB
Go Programming Language
For a great textbook to learn Go, read this textbook by Donovan & Kernighan
Why learn Go? Well, their entire webpage that explained literally that exact question may have had something to do with it. And I saw a youtube video yesterday saying how it was better than Rust, the literal most "loved" language currently in terms of long-term performance. So both of those two things got me sold.
They have a rather intuitive learning module called The Go Playground which makes it actually desirable to learn even.
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
func main() {
fmt.Println("Hello, 世界")
}
And tons more examples to try and out and learn from such as Conway's Game of Life and more.
This is how a fibonacci sequence could be implemented:
package main
import "fmt"
// fib returns a function that returns
// successive Fibonacci numbers.
func fib() func() int {
a, b := 0, 1
return func() int {
a, b = b, a+b
return a
}
}
func main() {
f := fib()
// Function calls are evaluated left-to-right.
fmt.Println(f(), f(), f(), f(), f())
}
With the output being: 1 1 2 3 5
When actually looking at it, it's kinda cool. It's not actually hard recursion like the way that it seemed like before with lisp.