Want: #slice: (Re: [squeak-dev] Noob question: array slice?)

Casey Ransberger casey.obrien.r at gmail.com
Fri Aug 6 10:06:36 UTC 2010


I get that, now, but thanks. What I really want, though, is to have a method in the system named something starting with 'slice,' because that's what I (and most of my friends, really,) would look for when trying to do the thing I was trying to do when I couldn't find a method that did what I wanted to do. When I think about grabbing a subset of a SequenceableCollection, I don't think to use the word 'copy' to find what I'm looking for. 

On Aug 6, 2010, at 2:54 AM, Ralph Johnson <johnson at cs.uiuc.edu> wrote:

> You want one of the copy methods from SequenceableCollection.  There
> are a bunch of them, and I always have to look up the exact name.  In
> your case, you want copyFrom:to: as in (anArray copyFrom: 2 to: 4)
> will give you a 3 element slides of anArray.   Since this is in
> SequenceableCollection, it will work with strings, arrays, ordered
> collections, etc.
> 
> -Ralph
> 



More information about the Squeak-dev mailing list