Lecture - Functional Programming, MT22, VIII
Flashcards
When all the conditions hold, what does fold fusion say about $\text{f} \cdot \text{fold g a}$?
The fold fusion law is
\[\text{f} \cdot \text{fold g a} = \text{fold h b}\]
How many conditions are there for this to hold?
3
The fold fusion law is
\[\text{f} \cdot \text{fold g a} = \text{fold h b}\]
What, broadly, are the three conditions for this to hold?
- Strictness
- Zero value
- Moving $f$ through
The fold fusion law is
\[\text{f} \cdot \text{fold g a} = \text{fold h b}\]What is the condition about stritcness?:: $f$ is strict, i.e. $f \bot = \bot$.
The fold fusion law is
\[\text{f} \cdot \text{fold g a} = \text{fold h b}\]
What is the condition about the zero value $b$?
\[\text{f a = b}\]
The fold fusion law is
\[\text{f} \cdot \text{fold g a} = \text{fold h b}\]
What is the tricky condition about “moving $f$ through”?
What is the identity $\text{id}$ function as a fold?
How do you determine if a function $f$ can be written as a fold?
Use fold fusion with the identity fold,
\[\text{f}\cdot \text{fold (:) []}\]