< :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
Ruby Arrays dynamically expand as needed. You can apply blocks to them to
return things like even numbers.
array = []
array.size # => 0
array[0] # => nil
array[9999] # => nil
array << 1
array.size # => 1
array << 2 << 3 << 4
array.size # => 4
array = (0..9).to_a
array.select do |e|
e % 2 == 0
end
# => [0,2,4,6,8]
Does this help?
On Sun, Aug 1, 2010 at 17:45, Andrew Wagner <wagner.andrew / gmail.com> wrote:
> How can I get a lazy array in Ruby? E.g., in Haskell, I can talk about
> [1..], which is an infinite list, lazily generated as needed. I can also do
> things like "iterate (+2) 0", which applies whatever function I give it to
> generate a lazy list. In this case, it would give me all even numbers.
> Anyway, I'm sure I can do such things in Ruby, but can't seem to work out
> how.
>