Andrew Durdin [EMAIL PROTECTED] wrote:
On 29 Dec 2005 09:50:57 -0800, colinwb [EMAIL PROTECTED] wrote:
puts ck.first, ck[0], '*', ck.last, ck[-1]
One of the points at issue (minimalism/monotony) relates to TOOWTDI,
which has implications for language/module design and for code
Dennis Lee Bieber [EMAIL PROTECTED] wrote:
...
code goo.last than goo[-1]. For an analogy, consider, in Python,
somestr.startswith('glab') as a more readable equivalent of
somestr[:4]=='glab' -- the why add? question is easily answered,
Using constants for the example does obscure
On 1/3/06, Alex Martelli [EMAIL PROTECTED] wrote:
Dennis Lee Bieber [EMAIL PROTECTED] wrote:
if somestr[:len(needle)] == needle:
This is definitely more readable, and the same would apply if I tested
somestr[:len('glab')] == 'glab' -- the key point being that one knows
where that slice
Apologies if I'm misunderstanding some points in kpd's post, but:
http://www.rubycentral.com/ref/ref_c_array.html
[ ]
arr[anInteger] - anObject or nil
arr[start, length] - aSubArray or nil
arr[aRange] - aSubArray or nil
Element Reference
Returns the element at index anInteger, or returns a
On 29 Dec 2005 09:50:57 -0800, colinwb [EMAIL PROTECTED] wrote:
puts ck.first, ck[0], '*', ck.last, ck[-1]
One of the points at issue (minimalism/monotony) relates to TOOWTDI,
which has implications for language/module design and for code
readability. Ruby supports negative indices in the same
list[-1] maps very well to my mental concept of list. To me 'List'
brings to mind a bunch of things in a line. It's intuitive to count
forward or backward.
Ruby's 'last' doesn't map as well for me because I don't think of the
list as having an attribute of 'last.'
Java just annoys me
Dave Benjamin wrote:
There's been a lot of discussion lately regarding Ruby and the notion of
a humane interface to objects like arrays and maps, as opposed to
minimalist ones. I believe the article that started the debates was
this one by Martin Fowler:
There's been a lot of discussion lately regarding Ruby and the notion of a
humane interface to objects like arrays and maps, as opposed to
minimalist ones. I believe the article that started the debates was this
one by Martin Fowler: