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