help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] What is wrong with my sort: block?


From: Rick Flower
Subject: [Help-smalltalk] What is wrong with my sort: block?
Date: Mon, 10 Dec 2012 18:28:58 -0800
User-agent: Apple Webmail/0.6

Ok.. First time using sort and I'm stumped..

I've got a collection of associations that look
kinda like this :

    [1]: './foo'->true
    [2]: './bar'->false
    [3]: './baz/->false

I want to sort them so the entry in the collection
with the 'true' association value is at the end --
so after sorting it should look like :

    [1]: './bar'->false
    [2]: './baz/->false
    [3]: './foo'->true

But when I execute something like that shown
below it always returns the same thing -- namely
no change..  I even tried hard-coding ^false when
it was only 2 entries and it made no difference..
Any ideas?

myCollection sort: [:a :b |
   a value ifTrue: [^false ].
   ^true.
].
myCollection inspect





reply via email to

[Prev in Thread] Current Thread [Next in Thread]