[sage-devel] Re: complementary problem

2010-08-12 Thread mda_
ordering, I'm just suggesting that since there is an inconsistent definition of for Sage sets, and since they get used frequently as vertices, that we define atotalordering. You yourself admitted that you can't think of a natural mathematical meaning for for arbitrary sets... If you

Re: [sage-devel] Re: complementary problem

2010-08-05 Thread Peter Jeremy
On 2010-Aug-04 14:51:21 -0700, Nils Bruin nbr...@sfu.ca wrote: There are other areas of mathematics where gets used for proper inclusion. A group theorist is going to be very surprised if for two groups H,G, the expression H G is valid but does not mean H is a subgroup of G. I expect this is

Re: [sage-devel] Re: complementary problem

2010-08-05 Thread Alex Ghitza
On Fri, 6 Aug 2010 07:06:33 +1000, Peter Jeremy peterjer...@acm.org wrote: On 2010-Aug-04 14:51:21 -0700, Nils Bruin nbr...@sfu.ca wrote: There are other areas of mathematics where gets used for proper inclusion. A group theorist is going to be very surprised if for two groups H,G, the

[sage-devel] Re: complementary problem

2010-08-04 Thread Robert Miller
I'm not sure what the point of a comparison function is if we don't implement a total ordering. The main place cmp methods get used is in sorting. If you have a large list of objects, and, for example, you want to know whether X is in the list, you might find this out by looping over the whole

[sage-devel] Re: complementary problem

2010-08-04 Thread Nils Bruin
On Aug 4, 4:23 am, Robert Miller rlmills...@gmail.com wrote: I'm not sure what the point of a comparison function is if we don't implement a total ordering. The main place cmp methods get used is in sorting. But it is a fact that Python has already abandoned total ordering semantics for . If

Re: [sage-devel] Re: complementary problem

2010-08-04 Thread Robert Miller
Nils, So you want Sage Sets to implement a b to mean a is a subset of b? I'll admit that that is reasonable, and it is a fact that it follows Python convention. But I think that the Python convention is bizarre, especially given how they implement sorting lists. I would also rather the sort

Re: [sage-devel] Re: complementary problem

2010-08-04 Thread Robert Miller
Also, consider the fact that many Sage functions use return sorted(output) to guarantee a consistent ordering of the output. What you're advocating means that this wouldn't work in many cases... On Wed, Aug 4, 2010 at 4:16 PM, Robert Miller r...@rlmiller.org wrote: Nils, So you want Sage Sets

[sage-devel] Re: complementary problem

2010-08-04 Thread mda_
Wow, I'm 100% certain I have nothing to add to this quandary, and couldn't possibly know the correct answer/choice, only supply the link to the relevant context Robert refers to: http://docs.python.org/release/3.0.1/whatsnew/3.0.html#ordering-comparisons Down the rabbit hole indeed. D On Aug

[sage-devel] Re: complementary problem

2010-08-04 Thread Nils Bruin
On Aug 4, 1:16 pm, Robert Miller r...@rlmiller.org wrote: So you want Sage Sets to implement a b to mean a is a subset of b? I'll admit that that is reasonable, and it is a fact that it follows Python convention. My initial reaction for this is affirmative: If python makes a choice, then sage

Re: [sage-devel] Re: complementary problem

2010-08-04 Thread Robert Miller
On Wed, Aug 4, 2010 at 5:51 PM, Nils Bruin nbr...@sfu.ca wrote: On Aug 4, 1:16 pm, Robert Miller r...@rlmiller.org wrote: So you want Sage Sets to implement a b to mean a is a subset of b? I'll admit that that is reasonable, and it is a fact that it follows Python convention. My initial

[sage-devel] Re: complementary problem

2010-08-04 Thread mda_
An alternative approach would be to realise that vertices need to be stored in a sequence that has quick membership testing, for instance a dictionary {'v1': 0, 'v2':1} etc. Depending on the type of access, perhaps you would also need to keep the thing as a sequence ['v1','v2']. In magma,

[sage-devel] Re: complementary problem

2010-08-04 Thread mda_
I don't know how easy it is to make such a data structure efficient and what the memory penalty is for having both hashing and ordering. http://docs.python.org/py3k/whatsnew/3.1.html#pep-372-ordered-diction... The reference implementation in the PEP(372) states O(n) for deletion of keys.

[sage-devel] Re: complementary problem

2010-08-04 Thread mda_
Another except from the PEP: A version written in C could use a linked list. The code would be more complex than the other two approaches but it would conserve space and would keep the same big-oh performance as regular dictionaries. It is the fastest and most space efficient. The trade-off

[sage-devel] Re: complementary problem

2010-08-04 Thread Nils Bruin
On Aug 4, 3:14 pm, Robert Miller r...@rlmiller.org wrote: If Python jumped off a cliff... Then Sage might as well :-). Or be reimplemented in CL. So then you would rather have Sage sets give an error rather than sort in a list? I can't imagine why this is a good thing. You seem to be ignoring

[sage-devel] Re: complementary problem

2010-08-04 Thread Nils Bruin
On Aug 4, 3:44 pm, mda_ donmorri...@gmail.com wrote: http://docs.python.org/py3k/whatsnew/3.1.html#pep-372-ordered-diction... Thanks! That makes me want to use Python 3.1. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to

Re: [sage-devel] Re: complementary problem

2010-08-04 Thread Robert Miller
Nils, First of all, I hope my distaste for the muggy weather hasn't made me unbearable. 0:-) When I was referring to things being much more difficult, I was thinking of implementing a cmp() function that took arbitrary hashables and defined a total ordering on all of them, consistent regardless

[sage-devel] Re: complementary problem

2010-08-04 Thread mda_
Hopefully this all agrees with you, and if not, I guess I can start learning Lisp... My apologies for the cross-posting (I am not yet approved for sage- flame) http://www.buayacorp.com/wp-content/uploads/2007/10/john-mccarthy-poster1.jpg (Above: A portrait, and tribute! ;-), to the

Re: [sage-devel] Re: complementary problem

2010-08-04 Thread Tim Daly
mda_ wrote: Hopefully this all agrees with you, and if not, I guess I can start learning Lisp... My apologies for the cross-posting (I am not yet approved for sage- flame) http://www.buayacorp.com/wp-content/uploads/2007/10/john-mccarthy-poster1.jpg The fact that you're doing it

[sage-devel] Re: complementary problem

2010-08-04 Thread mda_
The fact that you're doing it at all implies the imperative which, as we all know, is not the way to program (this week). http://en.wikipedia.org/wiki/Touché my friend(?) =) -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email

[sage-devel] Re: complementary problem

2010-08-03 Thread Nils Bruin
The problem of not providing a total ordering seems to come up again and again in different situations. There are two cases now already where it is clear that even in Python does not signify a total ordering anymore: - python complex numbers ( gives an error) - python sets ( denotes proper

[sage-devel] Re: complementary problem

2010-07-12 Thread Nathann Cohen
I think there lies the problem : sage: mcl_v = mcl.vertices() sage: mclc_v = mcl.complement().vertices() sage: mcl_v == mclc.v False So they are not equal. Do they contain the same elements ? sage: Set(mcl_v) == Set(mclc_v) True So it seems... But then, what does THAT mean ? sage: