[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dennou-ruby:001281] && and || of NArray
��߷�Ǥ���
NArray�� && �� || �ε�ư�����������Ȼפ���Τ���𤷤ޤ���
(���椵����ɤ�Ǥ�Τ���?)
�ʲ��Τ褦�ʥ�����ץȤ�¹Ԥ����
%cat test.rb
require "narray"
x = NArray.float(3).indgen
y = NArray.float(3).indgen
x = x>=2
y = y>=1
p x
p y
p x&&y
p x||y
%ruby test.rb
NArray.byte(3):
[ 0, 1, 1 ]
NArray.byte(3):
[ 0, 0, 1 ]
NArray.byte(3):
[ 0, 1, 1 ]
NArray.byte(3):
[ 0, 0, 1 ]
�Ȥʤ�ޤ���
���Ԥ���Τ�
&& -> [0,0,1]
|| -> [0,1,1]
���Ȼפ��ޤ���
----------
Seiya Nishizawa
seiya@xxxxxx