by chimeracoder · 13y ago · 0 comments
Why should it? "a.f(b, c, d)" is just "(apply #'f a b c d)". "a.f" is just (apply #'f a). "f" is just (apply #'f).
This assumes that you know the type of f, of course (f could be a string, which should't be applied). But that's not really much of an issue - you just do something like
(define (naive-evaluate f)
(if (applyable-p f)
(apply #'f)
f))
where "applyable-p" checks if "f" is a lambda term that has any free (unbound) variables.This isn't the most efficient underlying implementation, but you get the idea. From the perspective of the lambda calculus, OO is dead simple.
On a side, note, writing this example out reminded me of how much I really miss writing Lisp every day..... :'(
No comments yet.