package main
// 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.
println(f(), f(), f(), f(), f())
}
Go is available @ http://golang.org/#
There are 2 books on it:
David Chisnall's "The Go Programming Language Phrasebook"
and
Mark Summerfield's "Programming in Go: Creating Applications for the 21st Century"
Version 1.0 of the language was released in late March 2012 and binary distributions are available for Linux, FreeBSD, OS X and Windows. The language is open source and BSD-licensed.
No comments:
Post a Comment