Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有java示例代码
public int[] recognize(int[] x) { int[] y = new int[neurons.length]; for (int j = 0; j < neurons.length; j++) { y[j] = neurons[j].transfer(x); } return y; }
我需要把它转换成红宝石
在 Ruby 中,高阶函数优于显式循环。
def recognize(x) neurons.collect {|n| n.transfer(x)} end
def recognize x #returns all transfer results y=neurons.collect{|n|n.transfer x} y end