Using the specified list unfold, the definitions are
map f     = unfold null (f . head) tail
iterate f = unfold (const False) id f
For map, the current state is the remaining input list. null prevents head and tail from being evaluated on an empty list. For iterate, the stop predicate is always false and the output is the current state itself. Its transition is f, so the original seed is emitted before the first application of f.

Articles by others on the same topic (0)

There are currently no matching articles.