Am I the only one who finds the ruby protocol for accessing collections richer at times? In Smalltalk, if ary is an array, how do I get ary without its last element?
anArray allButLast
I know I'm sort of asking for the slaughter of a holy cow: Smalltalk only has telling and easy message names all over. Or wait, does it? There's of course Class >> #methodName. And 2 @ 3 for points.
There is the method finder, type #(1 2 3) . #(1 2) and it should give you the answer.
Just to put something on the table, how about:
(ary at: 1, -2)
Or, without braces, if you don't mind the reversal:
1,-2 @ ary
Or, consistent with current naming conventions:
(ary from: 1 to: -2)
See FScript (http://www.fscript.org/), it has quite cool syntax extensions for array programming. Lukas -- Lukas Renggli www.lukas-renggli.ch