[Haskell-beginners] Randomness, lists, and unfoldr

Stephen Tetley stephen.tetley at gmail.com
Mon Sep 13 16:10:00 EDT 2010


On 13 September 2010 20:24, Sriram Durbha <sriram.durbha at gmail.com> wrote:

> para morphism -> kind of ana but depends on input and output generated so
> far fib, fact etc?
> Im not sure i understood the last one well.

No - a paramorphism is a generalization of fold rather than unfold.
Basically it is a foldr where you can look further into the input
(foldr only lets you see the current element). It is sometimes
confusing to use the lookahead as foldr is working "backwards" from
the right.

An apomorphism is one generalisation of unfold. Apomorphisms are
unfolds + a flush operation that operates on the final state.

Jeremy Gibbons has a number of papers that are useful here - most
other presentations build *-morphisms with fixed point functors.

See the 'fission' paper for paramorphism and the paper 'Metamorphisms:
Streaming representation-changers' for apomorphism.

http://www.comlab.ox.ac.uk/jeremy.gibbons/publications/


The "Arithmetic Coding" papers are also worth reading for this topic.


More information about the Beginners mailing list