Sat Apr 17 14:40:47 EDT 2010
Classical Mechanics in Scheme and Abstract Interpretation
I'm thinking of translating Structure and Interpretation of Classical
Mechanics to Haskell as a tagless embedding: using type class
polymorphism to replace the Scheme generic functions. I never really
made this distinction in previous attempts to symbolic computation in
Scheme: generic functions are exactly what is needed to represent
numeric/symbolic computations with the same mechanism.
SICM seems like a nice book on its own, but it's the right book at the
right moment for me. Looks like I did learn something in these last
couple of months judging by the way that abstract interpretation
viewed in terms of generic functions feels completely natural now.
Apparently the detour through Haskell bondage was essential to make
things click. Types do add some value, especially for building
intuition and understanding.
What shifted is the idea that computer algebra systems are "magic" to
that they are essentially quite ad-hoc collections of computations in
the form of rewrite rules. I.e. a generic "simplify" method doesn't
exist; who defines whether a formula is simple?
Symbolic computation on the other hand is very well defined in terms
of operations on algebraic data types. Essentially there is little
difference between operations on primitive types such as numbers, and
composite types such as syntax trees representing algebraic
expressions. Expressions are really not all that special; they just
allow a richer set of "values".
This quite a mile stone in a journey that started about 10 years ago.
I guess Norvig is right. Bridging numerical and symbolic
computation in that way (making the latter accessable in everyday
programming) is basically what I always wanted.
The funny thing is that arriving at that point with appropriate
abstractions in my head _feels_ like an anti-climax, as if this
understanding has always been there and as if it isn't really so much
of an accomplishment.