4 ms·
Integers have an (intrinsic & natural) total order. Do characters? I'd say no. We represent them as integers, then expose those underlying integers because it's
by throwaway_pdp09 7y ago
Integers have an (intrinsic & natural) total order. Do characters? I'd say no. We represent them as integers, then expose those underlying integers because it's extremely useful for efficiency purposes, but I'd pretty strongly argue that that's an optimisation only and not an intrinsic to the alphabet.
'a' < 'b' only by accident of history. It could just as easily have been the reverse.
- falcor84 7y ago"betaalph" doesn't quite have that ring to it
- falcor84 7y agoAlso, it's worth noting that in Judaism and some other religions these things have religious significance stretched to them. In this particular example, Aleph is considered to equal 1 and Bet is considered to equal 2. https://en.wikipedia.org/wiki/Gematria https://en.wikipedia.org/wiki/Gematria
- eru 7y agoTo give some more examples: Tuples have a reasonable natural total order: just compare component wise. And minimum of a list of tuples makes sense. You could argue that alphabetic ordering is artificial, but it's hard to argue that it ain't well established and non-surprising. Interestingly, not all numbers have intuitive orders. Eg complex numbers don't really have a good preferred ordering. And the ordering of p-adic numbers is well defined and unique, but really weird.
- throwaway_pdp09 7y ago> Tuples have a reasonable natural total order No they don't. (1, 2) > (2, 1) = ??? To compare tuples you need a generalisation of comparison which includes 'incomparable' as an outcome. See lattices https://en.wikipedia.org/wiki/Lattice_%28order%29 https://en.wikipedia.org/wiki/Lattice_%28order%29 > but it's hard to argue that [alphabetic ordering] ain't well established it is, agreed... > and non-surprising ...agreed again, only because it's a convention you know so well (had it been reversed since your birth you'd say exactly the same thing). I agree with both points but that does not invalidate what I said abour alphabetic ordering being artificial.
- oefrha 7y agoThe set of tuples over a totally ordered set has a fairly natural total order as long as you accept the concept of precedence.
- throwaway_pdp09 7y agoSo evaluate (1, 2) > (2, 1) = ??? and tell me what ??? is, and why. I claim '>' is natural for 1 apple vs 2 apples, it is not natural for tuples unless you, as you say, suppose that the first in the tuple is more 'important' than the second WRT comparing. I mean I can accept that as a handy add-on, but it's not intrinsic - that's why lattices have 'incomparable', for just such a case.
- eru 7y agoOh, I think I wasn't careful enough with my language. I meant that the common ordering on tuples is reasonably natural. Not that it is necessarily the One True Natural Ordering. About lattices and partial orders: if there's a choice about what to pick as the default ordering for some built-in datatypes for your language and there are multiple reasonable choices, going with the total order seems like a good idea. To give a counterexample: functions from natural numbers to an orderable set have a well defined, reasonably natural order, just compare them like as if they were a list of elements of the orderable set. But that would be a bad idea in a programming language, and it is indeed better to just treat functions as incomparable by default.
- throwaway_pdp09 7y agoI think we can certainly agree on this. Thanks.
- int_19h 7y agoAnd Python does reflect this for complex numbers - you'll get an exception if you try to compare two for order.
- mulmen 7y ago0 and 1 are characters. The language of integers has an ordered 10 character alphabet. This is not unique among languages because it is a useful construct. Similarly we could have said b < a is true but then it would always be true and a < b would be false and the world would be exactly the same because this is all a made up convention for the benefit of humans.
- throwaway_pdp09 7y agoYou're confusing numerals with numbers. Numerals are what we write down "0" and "1" are numerals - just marks on a sheet of paper or phospor until interpreted by the human mind. Numbers are the underlying conceptual thing.
- nicoburns 7y agoDates objects are a good example of non-numbers that have an obviously well-defined order.
- throwaway_pdp09 7y agoTrue. What's your point?