ROLL with it, Baby!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{--

Okay, shoot! Fell asleep while composing a problem; sorry for the delay!

So, this one is an easy one. We get a little Forth'y'. This is from P19
of the P99 problem-set.

 --}

roll :: [a] -> Int -> [a]
roll list n = undefined

{--

roll rotates list n steps to the left. 

roll [1,2,3] 1 ~> [2,3,1]

The argument n can be negative, indicating that the rotation is to occur 
to the right, then, instead.

roll [1,2,3] (-1) ~> [3,1,2]

(Recall that we write '(-1)' and not just '-1' because '-1' is interpreted 
as the binary operator (-) applied to the Int 1)

The list can be rotated multiple times, so:

roll [1,2,3] 9 ~> [1,2,3]

Have at it!

Explanation: the term ROLL comes from the FORTH programming language,
placing the n-th element of the stack on TOS ('top of stack').

 --}

-- A solution is provided at http://lpaste.net/107063