Manuscript (Case [Issue]22160) Collection - Improve String>>#threeWayCompareTo:

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

Manuscript (Case [Issue]22160) Collection - Improve String>>#threeWayCompareTo:

Pharo Issue Tracker
Manuscript Notification
avatar
Henrik Nergaard opened Case 22160: Improve String>>#threeWayCompareTo: and assigned it to Everyone:
Bug in Project:  Collection: 1. Pharo Image  •  You are subscribed to this case
The method can be made more efficient by not doing two comparisons and instead using a the built in comparison method:

<code>

"protocol: *SortFunctions-Core-comparing"
threeWayCompareTo: aString
    "Do a three-way comparison between the receiver and aString, returning
    -1 if self < aString
    0 if self = aString
    1 if self > aString
    This assumes a total order in accordance with the mathematical law of trichotomy.
    See also:  http://en.wikipedia.org/wiki/Three-way_comparison"

    ^ (self compare: self with: aString collated: AsciiOrder) - 2

</code>
Priority Priority: 5 – Fix If Time Status Status: Work Needed
Assigned To Assigned to: Everyone Milestone Milestone: Pharo7.0

Go to Case
No longer need updates? Unsubscribe from this case.

Don't want Manuscript notifications anymore? Update your preferences.

Manuscript

_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
https://lists.gforge.inria.fr/mailman/listinfo/pharo-bugtracker