If I remember correctly, SETL only operates on explicitly enumerated sets,
not set variables. Is that wrong?
It does have good ideas about multiple representations for sets (bitmap,
list, etc.). Maybe we could use those.
I'd also want to make sure that as much as possible, operations on various
kinds of bags including sets, sequences (lists), multisets, etc. were
treated uniformly.
-s
On Thu, May 30, 2013 at 1:09 PM, David Stoutemyer <dstout at hawaii.edu> wrote:
> It might be worth studying the SETL programming language for ideas.
>
> -- david stoutemyer
>
>
> On Wed, May 29, 2013 at 4:02 PM, Robert Dodier <robert.dodier at gmail.com>wrote:
>
>> I've been tinkering with set operations on symbolic arguments. The
>> general plan is to make union, intersection, etc. simplifications of
>> noun expressions. A function $FOO just returns %FOO which is then
>> simplified, except for elementp -- more about that later.
>>
>> Mostly it has been pretty obvious so far. Union, intersection, and
>> symmetric difference are declared as n-ary, symmetric operators so the
>> general simplifier does part of the work. Any literal sets among the
>> arguments are combined and symbolic arguments are reduced if possible.
>>
>> (%i1) union (A, B, union (C, D, B), E);
>> (%o1) union(A, B, C, D, E)
>> (%i2) intersection (X, {1, 2, 4, 5}, {2, 5}, Y);
>> (%o2) intersection({2, 5}, X, Y)
>> (%i3) symmdifference (X, X);
>> (%o3) {}
>> (%i4) symmdifference (X, X, X);
>> (%o4) X
>> (%i5) symmdifference (X, X, X, Y, Y, Y);
>> (%o5) symmdifference(X, Y)
>>
>> 'intersection() acts as a universal set in intersection and elementp
>> (haven't gotten to union yet).
>>
>> (%i10) 'elementp (x, 'intersection (A, B));
>> (%o10) elementp(x, intersection(A, B))
>> (%i11) 'elementp (x, 'intersection ());
>> (%o11) true
>> (%i12) 'elementp (x, {});
>> (%o12) false
>>
>> elementp is an interesting problem. How to handle elementp(x, S) where S
>> is a literal set? If x is a symbol, how to distinguish x as a variable
>> from x as an actual element of S? The compromise I've come to so far is
>> to let the verb elementp act like a programming function while the noun
>> elementp acts like a mathematical function which simplifies under
>> certain conditions. At present 'elementp(x, S) simplifies to true/false
>> if x is a constant according to constantp(x) (and in some other
>> circumstances as well).
>>
>> (%i6) elementp (x, S);
>> (%o6) elementp(x, S)
>> (%i7) elementp (1, S);
>> (%o7) elementp(1, S)
>> (%i8) elementp (x, {1, 2, 3});
>> (%o8) false
>> (%i9) 'elementp (x, {1, 2, 3});
>> (%o9) elementp(x, {1, 2, 3})
>>
>> (%i13) 'elementp (%pi, {1, 2, 3});
>> (%o13) false
>> (%i14) 'elementp (3, {1, 2, 3});
>> (%o14) true
>>
>> Yes, that stuff about distinguishing noun/verb forms of elementp is
>> maybe a little too involved. Other ideas?
>>
>> Anyway I am curious to know if there is any interest in this general
>> approach. I'll put the code on a branch or something. Of course, so far
>> I've just scratched the surface; there is much more that could be done.
>>
>> best,
>>
>> Robert Dodier
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>