On Mon, Aug 3, 2015 at 12:04 AM, Peter Uhnák <i.uhnak@gmail.com> wrote:
(a b c) = (b a c) if a = b
(a b c) < (b a c) if a < b The semantics are well defined.
A comparison between sequenceable collections compares each element in sequence. This makes intutive sense.
Since you mentioned JavaScript, you should know that you can't compare arrays with ==, because it does object comparison.
I don't understand the introduction of == to the argument. Its not mentioned previously.
No. Sorted collection maintains order of its elements, and I'm talking about order on [the set of] sequencable collections
This will make sense only if the objects have overriden their #=.
It seems okay to me for the user to be responsible for ensuring elements put into SequenceableCollection can be compared.
Which also means that it is not very useful to use #<, because you can't define order without overriding #=.
Compare it to sorting a collection, where you can either do #sorted, which will do "a <= b" by default, but you can still do #sorted: and specify the sort order, ditto with PluggableDictionary etc. So if anything, it would make more sense to be able to block-based testing (without relying on #<), because more often then not you will have your values wrapped in some (bigger) objects.
And finally "Because in almost every programming language..." is not an argument.
Learning things from other languages *is* a reasonable argument, but it should not be the major consideration. cheers -ben
You could argue that "1 + 2 * 3" should return "7", because that's how every language does it and that's how mathematicians did it for thousands of years. And yet Smalltalk happily returns "9" and yet it makes sense, and some could argue that it's even better.
Peter
On Sun, Aug 2, 2015 at 4:59 PM, Alexandre Bergel <alexandre.bergel@me.com> wrote:
I'd say it is questonable if SequenceableCollections should be comparable by default.
+1
Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.