July 2023
Intermediate to advanced
670 pages
17h 13m
English
Thunks, Streams, Recursion, Co-Recursion! There’s been a lot to learn in this chapter! Before we move on, let’s take a look at one more example to help reinforce the concepts you’ve learned in this chapter. The Fibonacci series is a sequence of numbers that frequently makes an appearance in programming texts because it has the valuable property of having a simple recursive definition. In this section, you’ll build an infinite stream of Fibonacci numbers, and then look at several different ways that you can refactor the code to be more efficient.
Let’s start by defining the Fibonacci sequence. It’s a sequence of integers starting with [0,1]. You can calculate each number in the series by adding up the ...
Read now
Unlock full access