< :the previous in number
^ :the list in numerical order
> :the next in number
P :the previous (in thread)
N :the next artilce (have the same parent)
|<: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
Hi Peter,
I changed the arguments of the methods to start at 0:
> a =
> [ [10, 11, 20, 21],
> [12, 13, 22, 23],
> [30, 31, 40, 41],
> [32, 33, 42, 43] ]
def a.grid( i )
mid_row = size / 2
mid_col = self[ 0 ].size / 2
rows = if i < 2 then 0 ... mid_row else mid_row .. -1 end
cols = if ( i % 2 ).zero? then 0 ... mid_col else mid_col .. -1 end
self[ rows ].map { |elem| elem[ cols ] }
end
> a.grid(0)
> ==> [10, 11], [12, 13]
> a.grid(1)
> ==> [20, 21], [22, 23]
> a.grid(2)
> ==> [30, 31], [32, 33]
> a.grid(3)
> ==> [40, 41], [42, 43]
>
> b = a.grid(0)
> ==> [10, 11], [12, 13]
> b[0][0]
> ==> 10
> b[1][1]
> ==> 13
def a.row( i )
self[ i ]
end
> a.row(0)
> ==> [10, 11, 20, 21]
def a.col( i )
map { |elem| elem[ i ] }
end
> a.col(0)
> ==> [10, 12, 30, 32]
Regards,
Pit