l3x / learn-fp-go

Learning Functional Programming in Go
97 stars 53 forks source link

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

Closed jeffkayser2 closed 6 years ago

jeffkayser2 commented 6 years ago

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 6 years ago

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