plum-umd / abstracting-definitional-interpreters

Abstracting Definitional Interpreters
67 stars 2 forks source link

update-store vs := #8

Closed dvanhorn closed 8 years ago

dvanhorn commented 8 years ago

I'm working on writing about the basic ev unit and I'm a little confused by the difference between := which works on environments (and is syntax) and update-store. Is it not possible to write := for both environment and store update?

labichn commented 8 years ago

update-store f is just shorthand for get >>= lambda x . put (f x). I'd be glad to get rid of it.

davdar commented 8 years ago

\rho* := e . es is just syntax for (let ((\rho e)) (do es)). You can't imperatively update the environment, you can only supply a new environment to a nested computation via (local \rho* c), which runs the monadic action c in a context where it sees \rho* as its environment.

labichn commented 8 years ago

Not a bug, just a difference in how you have to interact with ReaderT and StateT.