Do I it means means not that think think what you [entries|reading|network|archive]
simont

[ userinfo | dreamwidth userinfo ]
[ archive | journal archive ]

Thu 2013-03-14 15:16
Do I it means means not that think think what you
Inspired by completely mistaking the meaning of a class name this week ...
Poll #13035 Hey, I ordered a cheeseburger
Open to: Registered Users, detailed results viewable to: All, participants: 26


I would take the phrase "ordered pair" to mean

View Answers

A pair (a,b) in which a <= b always
3 (11.5%)

A pair (a,b) in which (a,b) and (b,a) count as different unless a=b
19 (73.1%)

I would always ask which one you meant
3 (11.5%)

SEWIWEIC
1 (3.8%)

I would take the phrase "ordered list" to mean

View Answers

A list which is in order according to some sorting criterion, e.g. alphabetical
19 (73.1%)

A list in which order is significant, i.e. [1,2] and [2,1] are interestingly distinct
5 (19.2%)

I would always ask which one you meant
2 (7.7%)

SEWIWEIC
0 (0.0%)

I would take the phrase "ordered collection", in the context of data structures, to mean

View Answers

A data structure which keeps elements in an order determined by some sorting criterion
9 (36.0%)

A data structure which considers the order of elements to be an important part of what it's remembering
11 (44.0%)

I would always ask which one you meant
5 (20.0%)

SEWIWEIC
0 (0.0%)

[xpost |http://simont.livejournal.com/238403.html]

LinkReply
[personal profile] ptc24Thu 2013-03-14 15:25
For my mind:

An "ordered pair" pings the "fixed phrase" part of my mind.
A "list", strictly speaking, implies a data structure in which order is preserved. However, people can use lists for data where order is irrelevant, to represent a bag (or even a set), so there's an ambiguity there.
A "collection" is a very general concept, so there's vagueness there.
Link Reply to this | Thread
[personal profile] simontThu 2013-03-14 15:33
I think that for me the problem with "list" is that it's both a formal term for a particular data structure and an informal term for a bunch of items, so that a list{2} may or may not be stored in a list{1}, and it seems entirely possible that one's default parse for "ordered list" might depend on which sense came to mind first.
Link Reply to this | Parent | Thread
[personal profile] ptc24Thu 2013-03-14 15:37
Thank goodness we have "bunch" which isn't the formal term for any data structure... I hope.
Link Reply to this | Parent | Thread
[identity profile] deliberateblank.livejournal.comThu 2013-03-14 20:43
Clearly it refers to a tree with no particular arity constraints, where the leaf nodes are all spherical.
Link Reply to this | Parent
[personal profile] ewxThu 2013-03-14 15:42
SEWiwhatnow?
Link Reply to this | Thread
[personal profile] ewxThu 2013-03-14 15:42
Oh, got it. NM.
Link Reply to this | Parent
[personal profile] simontThu 2013-03-14 15:53
In case it confuses anyone else: "Something Else Which I Will Explain In Comments".
Link Reply to this | Parent | Thread
[personal profile] hilaritaFri 2013-03-15 00:22
I used a search engine to find out what it meant.
Link Reply to this | Parent
[personal profile] jackThu 2013-03-14 15:53
Huh, I never noticed that before. I think it's normally unambiguous because people don't normally say the opposites.

(I wouldn't always ask about "ordered collection" -- most likely it would be clear from context you were generalising pair or generalising list, but if it wasn't clear I'd ask.)
Link Reply to this | Thread
[personal profile] simontThu 2013-03-14 16:00
In this case, the context came from me rather than the API, as it were. As closely as I can reconstruct the thought process that led to the misunderstanding, I started by thinking "What I really want here is a thing just like a Python dictionary except that items() and keys() and viewitems() and so forth all reliably return the elements in sorted order", and then I vaguely recalled that there was a thing called collections.OrderedDict, and I assumed that must be the right thing because at that moment it hadn't occurred to me that it might mean anything else. And then I coded for days based on that assumption before getting to the point where the misunderstanding actually caused a problem (although, with hindsight, evidence of it had been visible for a while).
Link Reply to this | Parent | Thread
[personal profile] sparrowsionFri 2013-03-15 12:07
I guess you missed out on the near-intractable arguments prior to the introduction of OrderedDict as to exactly what an "ordered dictionary" meant. I think in the end the interpretation that won out did so because the behaviour you want is pretty easy to get with sorted(dict.keys()) etc, rather than it being more obvious or useful.
Link Reply to this | Parent
[personal profile] holdtheskyThu 2013-03-14 18:28
A pair (a,b) in which a <= b always : A range.

A pair (a,b) in which (a,b) and (b,a) count as different unless a=b : An ordered pair.

A list which is in order according to some sorting criterion, e.g. alphabetical: An ordered list.

A list in which order is significant, i.e. [1,2] and [2,1] are interestingly distinct: A list (as opposed to a bag).

A data structure which keeps elements in an order determined by some sorting criterion: A sorted list.

A data structure which considers the order of elements to be an important part of what it's remembering: An ordered list.

For me "ordered" means: a thing whose components are not interchangeable and, incidentally, are often represented positionally to determine which is which; whereas "sorted" means: some sorting criterion is invariantly true on operations. So [1,2] and [2,1] are ordered (if they differ in identity) but only [1,2] is sorted by the usual sorting on integers.
Link Reply to this
[personal profile] hairyearsFri 2013-03-15 13:39
I note that only one comment (so far) has drawn tbe distinction between 'ordered' and 'sorted'.

I hope I'm the only person here who sees a < b and prays to Great Cthulhu that I 'm not going to waste more time debugging code in which some misguided genius believes that 'Less Than' is a meaningful comparison operation for strings outside the task domain of alphabetical sorting.
Link Reply to this
navigation
[ go | Previous Entry | Next Entry ]
[ add | to Memories ]