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

Casey Ransberger casey.obrien.r at gmail.com
Fri Aug 6 09:44:15 UTC 2010


Bert, yer trollin' me.

The method finder was a useless waste of time for me in this case; I tried that. Alan's question (paraphrased:) How does one find the sine function if one doesn't know what it's called?

The lingua franca for this operation is "slice," in Perl, Python, and Ruby. That's what people (at least on the west coast of north America, and apparently Japan) seem to call it anyway. Is this a regional dialectic? Seems like I've seen the term used in enough (english) programming books to call it colloquial (at least in my own linguistic context.)

Far be it from me to challenge the great and otherwise particularly ancient Smalltalk standard in favor of what has become (for better or for worse) the commonest sense... and yes, I appreciate that Balkanization of protocol between dialects is a problem. But! Dude. It's called a friggin slice...
 
All I'm saying is, it might help new people find the damned thing if we called it (or aliased/wrapped it as,) #slice:. Having a message one can send of that name would have made the (yes, Bert!) friggin method finder actually useful to me in this case.

I know this message may seem a bit rash / flamish, but you can't even fathom the number of times I've removed a four letter word starting with $f from it. To be clear: I'll implement #slice:, if people want it. I don't know about the range thing though, I've never done a binary selector, and I don't know if any one that might make sense can be done without messing with the parser/etc. 

Arm your photon torpedoes, ladies and gentlemen, and lock onto me;)

Fire.

On Aug 6, 2010, at 1:03 AM, Bert Freudenberg <bert at freudenbergs.de> wrote:

> On 06.08.2010, at 08:03, Casey Ransberger wrote:
> 
>> Given that I have a collection like #(foo bar baz 1 2 3), and I want to get elements 2...4, what selector do I use?
>> I'm confused. Argh. Seems like I should be able to figure this out by now without what I think of being a pain. I guess I can just test the bounds, but yuck.
>> 
>> Halp! Invizibal #slice!
> 
> 
> Can haz method finder?
> 
> 	'hello'. (2 to: 4). 'ell'
> 
> - Bert -
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100806/97c2f385/attachment.htm


More information about the Squeak-dev mailing list