On 6/9/07, Robert Dodier <robert.dodier at gmail.com> wrote:
>
> Here's a thought. How about making it possible to declare that
> some operator distributes over some other operator.
I think this is a great idea. There are a couple of things to think about:
1) we need to distinguish the concept of being distributive (that is,
allowing expansion) and the concept of always distributing. For example,
"or" distributes over "and" and vice versa, but you don't want them both to
expand, otherwise a or (b and c) => (a or b) and (a or c) => (a and (a or
c)) or (b and (a or c)) etc. Do we want to generalize the "expand" function
somehow?
2) Some functions are left-distributive over others, some
right-distributive, some both, in which case you might want to control which
distribution you do. But that sounds messy.
3) I wonder what the relationship is between simplifying functions and
routines. If this is implemented as a simplifying function, it won't apply
to routines, so if you declare that diff distributes over lists, you'll get
something like this: diff([x,x^2]) => 'diff([x,x^2]) =>
['diff(x),'diff(x^2)], where the user might have expected [del(x),
2*x*del(x)]. (Actually, the diff routine already does this distribution,
but...)
4) Not sure what the right syntax is, but let's get the semantics down
first.
-s