[#1491] bug — Mathieu Bouchard <matju@...>
6 messages
2003/09/01
[#1492] non-blocking mode behavior (Re: bug)
— nobu.nokada@...
2003/09/01
Hi,
[#1512] New tests — Dave Thomas <Dave@...>
I was looking through the new test/ruby/* stuff just now, and notices
6 messages
2003/09/05
[#1533] GC disable / enable question — Torsten Rueger <torsten.rueger@...>
Moi,
7 messages
2003/09/17
[#1534] Re: GC disable / enable question
— nobu.nokada@...
2003/09/17
Hi,
[#1541] How to debug ? — Torsten Rueger <torsten.rueger@...>
Moi,
6 messages
2003/09/19
[#1542] Re: How to debug ?
— ts <decoux@...>
2003/09/19
>>>>> "T" == Torsten Rueger <torsten.rueger@hiit.fi> writes:
[#1551] Hashes as keys — "Nathaniel Talbott" <nathaniel@...>
I was just playing around with Hash#hash and discovered that you can't use a
13 messages
2003/09/23
[#1552] Re: Hashes as keys
— Jim Freeze <jim@...>
2003/09/23
On Wednesday, 24 September 2003 at 6:21:33 +0900, Nathaniel Talbott wrote:
[#1556] ostruct.rb patch — "Nathaniel Talbott" <nathaniel@...>
I've been finding OpenStruct to be very useful lately, and then I discovered
9 messages
2003/09/24
[#1557] Re: ostruct.rb patch
— "NAKAMURA, Hiroshi" <nahi@...>
2003/09/24
Hi, Nathaniel,
Re: |rcr|.xv Index Variables ( *_with_index )
From:
"daz" <dooby@...10.karoo.co.uk>
Date:
2003-09-03 18:05:50 UTC
List:
ruby-core #1508
From: <george.marrows@ps.ge.com>
> Dave provides a C api for setting the index value, so perhaps
> there should be a mechanism/syntax for setting it from Ruby
> code.
$XITER (horrible temporary name chosen by me to avoid clashes:)
gives access to a block's index from a script.
I wasn't expecting any interest in that.
It looks like a global var but it's local to the current scope
like $_ and some of the pattern-matching variables ($&, $' etc.).
Rather than changing the xv, send your value with yield.
If an xv is given, it will contain the default incrementing
value.
def roo
3.times do .x
yield 2*x
end
end
roo {|r1|.x p [x, r1]}
#-> [0, 0]
#-> [1, 2]
#-> [2, 4]
> BTW what about eg 'Hello'.each_byte {|ch;ix| puts ch} for the syntax?
> And of course {|;ix| } for the index only.
>
> -- George
My thinking was that the index isn't a block parameter [b/p]
(it doesn't affect the arity) so why must it be inside
the bars (which are delimeters for the b/ps) ?
However, your use of a single character is very much in line
with the spirit I was trying to capture.
daz