[Newbies] Re: How to sort a SortedCollection like you can sort a table in Excel?

Jerome Peace peace_the_dreamer at yahoo.com
Tue Apr 13 00:12:04 UTC 2010



--- On Mon, 4/12/10, keith <keith_hodges at yahoo.co.uk> wrote:

> From: keith <keith_hodges at yahoo.co.uk>
> Subject: Re: [Newbies] Re: How to sort a SortedCollection like you can sort a table in Excel?
> To: "A friendly place to get answers to even the most basic questions about Squeak." <beginners at lists.squeakfoundation.org>
> Date: Monday, April 12, 2010, 4:53 PM
> I add a <= to
> 
> then you can write:
> 
>  [ :a :b | { a width. a depth. } <= { b width. b depth }
> ]
> 
> regards
> 
> Keith

For the win!

Cool, Keith.

It's easy to forget how smart collection are.

Cheers, --Jer


> 
> 
> On 12 Apr 2010, at 17:52, Andreas Raab wrote:
> 
> > On 4/12/2010 7:48 AM, Bert Freudenberg wrote:
> >> Hmm, indenting it like this makes it more
> obvious:
> >>
> >>     a height>  b height or:
> [
> >>     a height = b height and: [
> >>         a
> width>  b width or: [
> >>         a width = b
> width and: [
> >>        
>     a depth>  b depth]]]]
> >
> > Personally, I write multi-level sort blocks like
> here:
> >
> >     a height = b height
> >         ifTrue:[a width
> = b width
> >        
>     ifTrue:[a depth >= b depth]]
> >        
>     ifFalse:[a width >= b width]
> >         ifFalse:[a
> height >= b height]
> >
> > Cheers,
> >  - Andreas
> > _______________________________________________
> > Beginners mailing list
> > Beginners at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
> 
> 
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> 


      


More information about the Beginners mailing list