[<<][meta][>>][..]
Tue Oct 25 13:18:04 EDT 2011

Zipper for Exp?

See [1] for a derivation.  Doing this straight from the polynomial
isn't really possible since it looses too much information.  Though
it's useful for verifying consistency.

One question that bubbles up though is how do I know what the current
toplevel expression is?  Suppose we have:

(Let a 123
(Let b 123
(Let c 123
  (Call f a b c))))

Here the continuation of the Call node needs to be made so that the
inverted Let node can be reconstructed.  The solution of course is to
insert a continuation that does this.  So we need to modify makeVar
after all.


makeVar :: TypeOf (Code t) => (Code t) -> MCode r (Code t)
makeVar term@(Code sterm) = SC c where  
  c (State bs n) k = k (State bs' $ n+1) (Code $ Ref $ var) where
    var = Var typ v 0
    v = regPrefix ++ (show $ n)
    bs' = (Bind var sterm) : bs
    typ = typeOf term

So instead of just calling k directly as in the definition above, we
install a new k that performs the inversion.

It seems simpler to then construct the data structure on an as-needed
basis, defining these continuations.

[1] entry://../compsci/20111025-132211



[Reply][About]
[<<][meta][>>][..]