F-Algebras

Prev: Comonads Next: Algebras for Monads

Prev: Comonads Next: Algebras for Monads

Exercises

  1. 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].
  2. Generalize the previous construction to polynomials of many independent variables, like .
  3. Implement the algebra for the ring of matrices.
  4. Define a coalgebra whose anamorphism produces a list of squares of natural numbers.
  5. Use unfoldr to generate a list of the first primes.