Sun Jun 2 09:27:14 EDT 2019
Cleaning up the language
So there is still a bit of work to fit the data language to the
First: dereferencing is always explicit.
I think I need to start over.
The LTA form is not what I'm looking for.
EDIT: So I've split up LTA (which now has a simple data structure
print statement to serve as an example), and Loop, which is built
around being able to represent this thing:
p :: ArrayZero t => (Array (Array t)) -> (Array (Array t)) -> M (Array (Array t))
p a b = do
d <- loop $ \i -> do
loop $ \j -> do
aij <- ref2 a i j
bij <- ref2 b i j
c <- op2 "mul" aij bij
d <- op2 "mul" aij c
loop $ \i -> do
loop $ \j -> do
dij <- ref2 d i j
c <- op2 "mul" dij dij
e <- op2 "mul" c c
I'm going to need a break.
So there is a pattern: I often want a language with a particular
control structure around an otherwise form. How to do that more
Looks like the inconsistency comes from the inability to represent the
referencing properly in the data type. The final embedding has no
issues with nested types, but the data type itself can't do that, so
likely needs to use a flat encoding.
Ok I am just not seeing the big picture.
There is a real issue in mixing partial application and loop nesting
(at the embedding side) and the need for uncurried representation in
the main language.
It seems best to treat arrays as a special kind of function that has
"abstraction" (loop), and "application" (ref).
Here's an idea:
- pretend that the language is higher order. variables can contain
partially applied array references. those are just compile time
entities because they will need to resolve to scalars when
operations are involved.
Ok this is actual progress.