< :the previous in number
^ :the list in numerical order
> :the next in number
P :the previous (in thread)
N :the next (in thread)
|<:the top of this thread
>|:the next thread
^ :the parent (reply-to)
_:the child (an article replying to this)
>:the elder article having the same parent
<:the youger article having the same parent
---:split window and show thread lists
| :split window (vertically) and show thread lists
~ :close the thread frame
.:the index
..:the index of indices
> Given the class:
>
> class Data2D
> def initialize
> @data = [ ] # in row major form
> end
>
> def add_row(*row)
> @data << row
> end
> end
>
> And this setup for an object:
>
> data = Data2D.new
> data.add_row(1, 2, 3, 4)
> data.add_row(5, 6, 7, 8)
>
> Define a [] method for the class that makes this form of access possible:
>
> x = 2
> y = 1
> data[x][y] # => 7
>
How about
def [](i)
@data.map {|row| row[i]}
end
>> Post your solution AND a followup problem for others to solve.
Oops, I'll have to think about that... but not tonight
... on a completely different topic... I've noticed that whenever I
post a message to ruby-talk / ruby-lang.org from my gmail account, I get
the message twice in my inbox, making me wonder three things...
1) Does everybody get my messages twice? If so, I humbly apologize
and will stop posting immediately as I can see where this could be
just a tiny little bit annoying.
2) Does anybody else have this problem? If so
3) How did you solve it (assuming it's a solvable problem)?
--wpd