General

Profile

mohawkjohn (John Woods)

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 1 0 1

Activity

10/26/2013

02:44 PM Ruby Feature #9049: Shorthands (a:b, *) for inclusive indexing
@boris_stitnicky What about ~? x[3~4,1~5], for example. I don't like it as much as colon, but it looks a little more intuitive than %. mohawkjohn (John Woods)

10/24/2013

11:55 PM Ruby Feature #9049: Shorthands (a:b, *) for inclusive indexing
Yes. 1:2 is the same as 1..2; it's inclusive of the begin and end indices. It is not equivalent to 1...2.
I would think non-number indexing *should* be allowed — but you make a good point. This wouldn't work if implemented via Hash, b...
mohawkjohn (John Woods)
03:50 PM Ruby Feature #9049: Shorthands (a:b, *) for inclusive indexing
@boris_stitnicky I don't think it matters if it collides. It's simple to convert a key-value pair into a range in C code or in Ruby.
@david_macmahon It'd be nice if it could be done in other functions. In NMatrix, we have both [] and ...
mohawkjohn (John Woods)
11:54 AM Ruby Feature #9049 (Open): Shorthands (a:b, *) for inclusive indexing
For NMatrix, we've implemented a range shorthand which relies on Hashes: `m[1=>3, 2=>4]`, for example, which returns rows 1 through 3 inclusive of columns 2 through 4 (also inclusive). The original goal was to be able to do `m[1:3, 2:4]`... mohawkjohn (John Woods)
11:56 AM Ruby Feature #9047: Alternate hash key syntax for symbols
@matz Very well, and thank you for the consideration. I opened a new issue on that topic: #9049. mohawkjohn (John Woods)
12:54 AM Ruby Feature #9047: Alternate hash key syntax for symbols
This may or may not be related, but we here at NMatrix (part of SciRuby) would love to be able to index ranges in NMatrix using a 1:3 notation. This can be accomplished with a hash, but only if it will allow numeric (rather than symbolic... mohawkjohn (John Woods)

Also available in: Atom