Can't figure out the error in my function. It is supposed to cycle through a list n number of times, eg:
cycle([1, 2, 3, 4, 5, 6], 2) would return
[3, 4, 5, 6, 1, 2], cycling the list twice.
Here is my code, but I think I am entering into an infinite recursive loop. Any help?
fun cycle (a, n) = if n >= 0 then cycle (cycle1 a, n-1) else cycle (a, n-1);