The final week of the course brought together all of the previous concepts and capabilities to leverage lazy evaluation.
Structural Inductions on trees can be conducted in a number of ways. Obviously they are all bound by logic and I was somewhat confused by the level of detail that this topic was covered on. Perhaps because this concept is not readily available in imperative languages.
Streams was the next topic and one that was used extensively in the week 7 assignment.
((1000 to 10000) filter isPrime)(1)
Above is very inefficient as it finds all prime numbers between 1000 and 10,000, whilst only using element 0 and 1 from the results.
A good solution is to avoid evaluating all of the numbers in the list from 1000 to 10,000 is the .toStream function.
((1000 to 10000).toSteam filter isPrime)(1)
Lazy evaluation was demonstrated next, its importance paralleled to that of streams
Week 7 assignment source – first pass, lots of problems