repl.it
@anonymous/

PunySquigglyDowitcher

Ruby

No description

fork
loading
Files
  • main.rb
main.rb
1
2
3
4
5
6
7
8
f=->p,q{p.zip(q).map{|a,b|(a-b)**2}.reduce(:+)**0.5}

p f[[1], [3]] # 2
p f[[1,1], [1,1]] # 0
p f[[1,2], [3,4]] # 2.82842712475
p f[[1,2,3,4], [5,6,7,8]] # 8
p f[[1.5,2,-5], [-3.45,-13,145]] # 150.829382085
p f[[13.37,2,6,-7], [1.2,3.4,-5.6,7.89]] # 22.5020221314
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]