F-Algebras
Prev: Comonads Next: Algebras for Monads
Prev: Comonads Next: Algebras for Monads
Exercises
- Implement the evaluation function for a ring of polynomials of one variable. You can represent a polynomial as a list of coefficients in front of powers of . For instance, would be represented as (starting with the zero’th power)
[-1, 0, 4]. - Generalize the previous construction to polynomials of many independent variables, like .
- Implement the algebra for the ring of matrices.
- Define a coalgebra whose anamorphism produces a list of squares of natural numbers.
- Use
unfoldrto generate a list of the first primes.