Sun Apr 21 09:53:06 EDT 2019
Loops are environments
( Relation to Representable functors? )
Luckily, I just need vectors at this time, so it can be quite
concrete. Vectors will be the base for all
Functor, Traversable, Foldable, Zip behavior
There are only two operations that are important at this time:
- fold (accumulation, vector to scalar reduction)
- zip (vector to vector maps)
Is there a natural way to express these? Yes, by assuming each loop
has a single structure that is natural to C-like code:
- input / output vectors
- accumulators / state
- nested versions of these
Then implement the standard classes in terms of these primitives.
How do I start this? Probably best by extending Term.hs such that
C.hs can generated it.
It doesn't feel like today is the day for it though.
- Declare and initialize accumulators
- Declare vectors
- Insert the loop head
- Insert the loop body
EDIT: Some key insight is missing. This is a tangle, and I need to
find a starting point to then see the loose ends.