Assos

Anonymous Coward 2018-03-06 23:41:32.805215 UTC

1reverse l = rev l []
2 where
3 rev [] a = a -- if list empty return a = [reversed_array_holder]
4 rev (x:xs) a = rev xs (x:a)
5
6
7function reverse(l) {
8
9 function rev(l, a) {
10 if (l.length == 0) {return a}
11
12 a.unshift(l[0])
13 return rev(l.slice(1), a)
14 }
15
16 return rev(l, [])
17}