The Trunk: Collections-nice.583.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-nice.583.mcz

commits-2
Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.583.mcz

==================== Summary ====================

Name: Collections-nice.583
Author: nice
Time: 19 September 2014, 10:54:26.296 pm
UUID: 7c0afd87-bf86-40d5-890e-eb3f4ad51e68
Ancestors: Collections-nice.582

Also classify these SortFunction support in *Collections rather than *Kernel

=============== Diff against Collections-nice.582 ===============

Item was added:
+ ----- Method: BlockClosure>>asSortFunction (in category '*Collections-Support-sorting') -----
+ asSortFunction
+
+ ^self ascending!

Item was added:
+ ----- Method: BlockClosure>>ascending (in category '*Collections-Support-sorting') -----
+ ascending
+ "Return a SortFunction around the receiver. If the receiver is a 2 arg block, it is assumed it will do the collation directly itself, returning -1, 0, or 1. If the receiver is a one arg block, it will be evaluated for each a and b and of the sort input, and the result of sending <=> to those will be used."
+
+ | function |
+ function := SortFunction ascend.
+ self numArgs = 1 ifTrue: [function monadicBlock: self].
+ self numArgs = 2 ifTrue: [function collator: self].
+ ^function!

Item was added:
+ ----- Method: BlockClosure>>descending (in category '*Collections-Support-sorting') -----
+ descending
+ "Opposite direction as ascending."
+
+ ^self ascending toggleDirection!