guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: goops and memoization


From: Tom Lord
Subject: Re: goops and memoization
Date: Tue, 3 Dec 2002 18:49:59 -0800 (PST)

       > Have you considered the approach of writing a custom optimizer (not O,
       > but another optimizer) that can do a good job of "compiling" (scheme
       > to scheme):
       >
       >
       >        (lambda (ms) (M (O (U ms))))
       >
       > ?


       Hmm... could you please clarify this suggestion.  What is the
       core idea?  To specify O in a custom language and compile it?
       To optimize the composition of M O and U?  Something else that
       I have missed?


O, I am presuming, optimizes method selection, presumbably by ordering
tests of argument types in favorable orders and by generating
special-case tests where, otherwise, a generic search would be
required.   Have I missed something?

So, O is a fairly straightforward scheme->scheme transform.  It can
almost certainly be expressed in very regular form (a "custom
language" (such as a pattern-matching macro plus quasiquote) -- or
simply a narrow Scheme subset).

M and U are similar.

You can write them as three separate functions, and write a customized
optimizer that folds them together.  It might even be able to take
advantage of non-general optimizations that apply only to these
functions.

You could look at the custom optimizer as a constant-folding exercise,
an abstract-evaluation exercize, or a partial-evaluation exercize
(where you are partially evaluating "(apply (compose M O U)
free-ms)").

The reason I think this is a plausible approach is just that the three
transforms involved (M O and U) don't need to be arbitrary code -- you
can do very well here just by thinking of them as pattern-matching
rewrite systems -- and such systems compose cleanly and should be easy
to optimize.

Clearer?  or did I just make it worse :-)


(I used to suspect that Aubrey secretly generated `eval' using
techniques along these lines but eventually concluded: nah, he just
writes very consistent code. :-)

-t





reply via email to

[Prev in Thread] Current Thread [Next in Thread]