l3x/learn-fp-go

fib(5) = 5. Book says fib(5) = 8.

jeffkayser2 opened this issue · 1 comments

Section: Fibonacci sequence - a simple recursion

"...Only the final leaf nodes of 1 are added together to calculate the sum total of 8:
func main() {
fib := Fibonacci
fmt.Printf("% vn", fib( 5))
}
Run that code and you'll get 8..."

l3x commented

Hey Jeff, It says fib(5) = 8 because the version of the book you're reading is a draft. The publisher was has since published a revision. You should be able to get the revision for free....and in the final version of the book that error has been corrected.

Please let me know if you have any issues getting the latest revision.

See also http://lexsheehan.blogspot.com/2018/08/book-revision-learning-fp-in-go.html

Cheers!
Lex