unintuitive select

Brian Rice water at tunes.org
Sat Jul 3 12:04:17 PDT 2004


No, it's a feature. It's part of ANSI Smalltalk that select: and 
reject: don't re-position elements. Dictionaries and other Mappings 
work the same way.

If you want just the selected elements, you can do:

({1. 2. 3} reader select: [| :a | a > 2]) contents.

On Jul 3, 2004, at 7:33 AM, John Leuner wrote:

> Slate 1>  {1.2.3.} select: [ | :a | a > 2 ].
> {Nil. 3}
>
> {1.2.3.4.5.6.7.8.9.}  select: [ | :a | a > 2 ].
> {Nil. 3.4. 5.6. 7.8.
>         9}

THIS, on the other hand, is you confusing the parser. :D Liberal use of 
periods between digits without separators is liable to make it think 
you want Floats and not Integers.

> Is this a bug?
>
> John
>
> -- 
> John Leuner <jewel at pixie.co.za>
>
>
--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/




More information about the Slate mailing list