From: shevegen@... Date: 2017-02-12T20:15:08+00:00 Subject: [ruby-core:79507] [Ruby trunk Feature#13208] Vector.zero(n) and vector.zero? Issue #13208 has been updated by Robert A. Heiler. I think the method is fine but of course that is just my own opinion, the core team and matz will decide that. One hopefully small request though: - Do you think you could make the description for the method a bit more explicit? Right now the documentation to it states only: "Return a zero vector." Perhaps this is obvious to others but I am not entirely sure what a zero vector per se is, although of course the example is explicit enough to infer from it (I assume a zero vector is one that contains only 0 as its members but from the documentation alone, without the example, I am not sure everyone may be able to infer this completely correctly so.) ---------------------------------------- Feature #13208: Vector.zero(n) and vector.zero? https://bugs.ruby-lang.org/issues/13208#change-62956 * Author: Chia-sheng Chen * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Found that I need this recently, and class `Matrix` has these two function while `Vector` not. So I add two function based on `Matrix` counterpart and also add test. Usage ``` ruby require 'matrix' v = Vector.zero(3) # => Vector[0, 0, 0] v.zero? # => true w = Vector[1, 0, 0] w.zero? # => false ``` ---Files-------------------------------- 0001-Add-Vector.zero-n-and-vector.zero.patch (2.06 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: