Fri Feb 2 12:35:56 GMT 2007
purely compositional approach (joy)
whenever program text is read, it is immediately compiled. each symbol
is replaced by it's particular function, and each constant is replaced
by a function that pushes the constant.
sym -> (lookup sym)
data -> (lambda stack (cons data stack))
to get back the value of a data atom (practical issue), you pass any
list, apply the function, and pop off the data.
this can be done at compile time.
so, can we do with data structures composed entirely of functions?
probably yes.. probably this isn't even such a bad idea..
it looks like it is not a good idea to map composition to single
lambda expressions, but to have an interpreter for it instead, so we
can implement things like CAR efficiently: it is possible to implement
CAR on an abstract function which represents a list by 'testing' it on
a stack, however, this is a lot worse than just getting the left
element of the first pair..
then, why not represent constants by constants instead of their
wrapping functions? back to square one..