On Apr 17, 8:16 am, Harald Schilly <[EMAIL PROTECTED]> wrote:
> On Apr 17, 1:08 pm, kcrisman <[EMAIL PROTECTED]> wrote:
>
> > The point is that I'm not sure how to tell elements that they
> > are greater than each other without defining a new class with _cmp_ or
> > something, which would be the opposite of my goal of being able to
> > dynamically assign an ordering to an arbitrary set.
>
> I don't understand entirely what you want, but you can write your own
> compare function ( def comp(x,y): ... returns {-1,0,1} ) and plug it
> into the sort function of an array (a.sort(comp)). That's basic
> python.
> Then just the compare function defines the element ordering,
> independent of the element class.
>
> But maybe I missed your point, Harald
Hmm, I figured something like this was possible, so that is a good
place to start. Thank you.
However, what I really want is to be able to do this dynamically and
to have the output be an "ordered set". Maybe an example would be
that I might want to list different orders of operations, so that
object A="exponentiation>multiplication>addition" would be my normal
list, but then I could have another ordering be the (wrong but
potentially fun) B="addition>multiplication>exponentiation", and that
if I wanted to then put in subtraction in B, I could infix it to be
B="addition>multiplication=subtraction>exponentiation" for a LOT of
fun.
I was thinking now that maybe just a list (which has an implicit
ordering and lots of functions on it) would work, but I don't know
that it would allow "=" between elements very easily.
- kcrisman
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---