Hi,
In message "[ruby-talk:02714] Re: Append alias for Array.append?"
on 00/05/10, Aleksi Niemel<aleksi.niemela / cinnober.com> writes:
|it would be nice to write
|
| b[2,3] = a.pop(3)
|
|instead of
|
| 2.down_to(0){ |i| b[2+i] = a.pop() }
|
|or
|
| b[2,3] = a[-3,3]
| a[-3,3] = []
How about 'b[2,3] = a.slice!(-3,3)'?
|> (append '(a b c) 'd)
|> (append '(a b c) '(d e f))
|
|What this does by the way?
(append '(a b c) 'd) ; => (a b c . d)
(append '(a b c) '(d e f)) ; => (a b c d e f)
It does not modify a list; returns copy of the list,
matz.