Hi!
Mondrian has the method sortedAs:. Here is a test:
testSortedAs
self assert: (#(5 4 3 2 1) sortedAs: #value) asArray = #(1 2 3 4 5).
self assert: (#(5 4 3 2 1) sortedAs: #odd) asArray = #(5 1 3 4 2).
self assert: (#(5 4 3 2 1) sortedAs: #even) asArray = #(2 4 3 5 1).
self assert: (#(5 4 3 2 1) sortedAs: [:v1 :v2 | v1 < v2 ]) asArray = #(1 2 3 4 5).
self assert: (#(5 4 3 2 1) sortedAs: [:v | v * v ]) asArray = #(1 2 3 4 5).
self assert: (#(5 4 3 2 1) sortedAs: #squared) asArray = #(1 2 3 4 5).
self assert: (#(5 4 3 2 1) sortedAs: [:v | v negated ]) asArray = #(5 4 3 2 1).
sortedAs: takes as argument, one-arg block, two-arg block.
I was wondering whether this method could not be part of Pharo.
Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev