Sat Jul 16 18:39:40 CEST 2011

Separate memo function

What I want to do is to allow for the insertion of a function that
intercepts the value, stores it in the state, and passes the state and
reference on.

What should this be?  It should be a SC computation that has a
specialized type.

Following [1][2] this is really just a specialized form of return:

tmpvar n = var ("R" ++ (show n))

returnN val = SC c where  
  c table k = k table' ref where 
    table' = (ref,val):table
    ref = tmpvar $ length table

This is it.  It all just works now.  Wicked.

[1] http://www.cs.rice.edu/~taha/publications/conference/pepm06.pdf
[2] http://www.cas.mcmaster.ca/~carette/publications/scp_metamonads.pdf