Mon May 20 10:59:15 EDT 2019


It was very important to do the monadic language, because it is
already quite clear there is something not right with the way bindings
and loops interact.

About the SC monad: maybe it just isn't the right abstraction?  A free
monad might work better.

Maybe let insertion is just different: because of scoping rules, the
forking is not an issue.

So there are a couple of conclusions:

- Each sequence of bindings has a clear return value.

- A sequence of loops should also return something.  Currently that
  can't be expressed.

I need to find a bridge between values and assignments.

The return value of a sequence of primitives would be a list of cells.

The return value of a loop is an array slice.

prim / loop

The conceptual error is that a loop binds an array slice, just like a
primitive binds a cell.  So the IR tree is structured in a bad way.

Fixing that is a big change.

A Form is Let | Ret
A Binding is either a prim or a loop

I do wonder though for all of this if the transformations are really
necessary, because the language will be able to represent fused

Split it off in a separate structure or fix?

There is a strong tension between:
- nesting data structures
- adding an index

Note that loop will need to be a "map style" operation.  It needs to
map something that is scalar to something that is vector, and vector
to matrix etc..