fork(1) download
  1. # your code goes here
  2. f=->a{a.map{|e|e!=[*e]?[e]:f[e]}.inject:+}
  3.  
  4. p f.call([[10]])
  5. p f.call([[[20],["Hi"],"Hi",20]])
Success #stdin #stdout 0.05s 9616KB
stdin
Standard input is empty
stdout
[10]
[20, "Hi", "Hi", 20]