On Thu, May 21, 2015 at 4:39 PM, Max Leske <maxleske@gmail.com> wrote:
On 21 May 2015, at 16:31, phil@highoctane.be wrote:
56 <=> 43 --> -1
"abcd" <=> "defgh" --> +1
I said âobject orientedâ⦠:p
Bah, let's got with lots of ifTrue:ifFalse: ... Hopefully, a kind soul will iterate on this and make it OO :-) Object>><=> anObject self flag: #TODO. "Return nil if they are not comparable" ^[:a :b | a > b ifTrue: [ 1 ] ifFalse: [ a < b ifTrue: [ -1 ] ifFalse: [ 0 ] ] ] value: self value: anObject 10 <=> 20. 'abc' <=> 'def'. Phil
Just get a numerical result out of it.
Phil
On Thu, May 21, 2015 at 4:22 PM, Max Leske <maxleske@gmail.com> wrote:
On 21 May 2015, at 15:01, phil@highoctane.be wrote:
On Thu, May 21, 2015 at 2:19 PM, Sean P. DeNigris <sean@clipperadams.com> wrote:
Squeak 4.6 "Spur" Release Notes http://wiki.squeak.org/squeak/6192
Tag sort functions looks great to have around.
About the spaceship operator (<=>), is this something we'd like to have around? (I like it). http://en.wikipedia.org/wiki/Three-way_comparison
How would you make this âobject orientedâ? Have three singleton objects âLessâ, âGreaterâ, âEqualâ (similar to âTrueâ, "Falseâ), and on those object methods âifLess:â, âifEqual:â, âifGreater:â?
Phil
----- Cheers, Sean -- View this message in context: http://forum.world.st/Opportunity-to-steal-good-ideas-from-dad-tp4827836.htm... Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com <http://nabble.com/>.
--