[#66126] Creation/Conversion methods/functions table for Ruby types — SASADA Koichi <ko1@...>
Hi,
5 messages
2014/11/07
[#66248] [ruby-trunk - Feature #10423] [PATCH] opt_str_lit*: avoid literal string allocations — normalperson@...
Issue #10423 has been updated by Eric Wong.
3 messages
2014/11/13
[#66595] [ruby-trunk - Bug #10557] [Open] Block not given when the argument is a string — bartosz@...
Issue #10557 has been reported by Bartosz Kopinski.
3 messages
2014/11/30
[ruby-core:66363] [ruby-trunk - Feature #10445] [Feedback] [PATCH 3/3] Extend Matrix#[]
From:
ruby-core@...
Date:
2014-11-19 17:54:29 UTC
List:
ruby-core #66363
Issue #10445 has been updated by Marc-Andre Lafortune. Status changed from Open to Feedback I understand the idea, but I'm not convinced. Currently, [] is a simple access to the elements of a matrix. This proposal makes it more complex and changes completely the type of return depending on the arguments. The main question is: when would someone want to extract a minor from a matrix and much prefer calling `[]` instead of the clearer and explicit `minor`? I feel like we should favor explicitness in this case. ---------------------------------------- Feature #10445: [PATCH 3/3] Extend Matrix#[] https://bugs.ruby-lang.org/issues/10445#change-50014 * Author: gogo tanaka * Status: Feedback * Priority: Normal * Assignee: Marc-Andre Lafortune * Category: lib * Target version: ---------------------------------------- I've made patches which Matrix#[] returns new vector if either arguments is range, and returns new matrix, if both arguments are range. Like below. ```ruby # matrix[row, column] -> obj or nil # matrix[row, col_range] -> new_vector or nil # matrix[row_range, column] -> new_vector or nil # matrix[row_range, col_range] -> new_matrix or nil Matrix.diagonal(9, 5, -3)[1, 1] => 5 Matrix.diagonal(9, 5, -3)[1, 0..1] => Vector[0, 5] Matrix.diagonal(9, 5, -3)[0..1, 0] => Vector[9, 0] Matrix.diagonal(9, 5, -3)[0..1, 0..1] => Matrix[[9, 0], [0, 5]] ``` I'm not sure `matrix[row, col_range] ` should return `vector` or `matrix` But from my view, it's fine. I'm not in a hurry. Take your time. ---Files-------------------------------- add_test.patch (1.05 KB) implement_matrix.rb.patch (1.96 KB) update_NEWS.patch (825 Bytes) -- https://bugs.ruby-lang.org/