Lecture notes for COMP 371/471: Programming languages course at Loyola University Chicago with a focus on functional languages and projects mostly in Scala
MIT License
1
stars
1
forks
source link
add Fibonacci and Sieve of Erasthosthenes examples in appropriate places #31
Start with imperative, then naive, inefficient recursive version, then introduce accumulator.
Efficient but doesn't memoize!
and/or
Also implement nonrecursively using iterate!
Do something similar for the sieve (corecursion)!
TODO express as LazyList
Seq.unfold
is the equivalent toIterator.iterate
for building finite structures; both can be considered anamorphisms.Then add F-algebraic versions based on Droste examples and reference below.
Reference: https://bartoszmilewski.com/2017/02/28/f-algebras/