|
Versions Of This Snippet::
Download a raw-text version of this code by clicking on "Download Version"
Latest Snippet Version: :1
class Array
def *(a)
n = Array.new
[ self.length, a.length].max.
times do |x|
n[x] = ( self[x] || 0 ) * ( a[x] || 0 )
end
n
end
end
#[ 2,4,4 ] * [ 5,5 ]
# =>[10,20,0]
Submit a new versionYou can submit a new version of this snippet if you have modified it and you feel it is appropriate to share with others..
|
||||||||||||||||||||||||||||||||||||
