Skip to content

Instantly share code, notes, and snippets.

@dtak1114
Last active December 17, 2015 13:48
Show Gist options
  • Select an option

  • Save dtak1114/5619449 to your computer and use it in GitHub Desktop.

Select an option

Save dtak1114/5619449 to your computer and use it in GitHub Desktop.

Revisions

  1. dtak1114 revised this gist May 21, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rotate.hs
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    rotate x 0 = x
    rotate x n
    | n == 0 = x
    | n >= (length x) = rotate x (mod n (length x))
    | otherwise = rotate (tail x) (n-1) ++ [head x]

  2. dtak1114 revised this gist May 21, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rotate.hs
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    rotate x 0 = x
    rotate x n
    | n > (length x) = rotate x (mod n (length x))
    | n >= (length x) = rotate x (mod n (length x))
    | otherwise = rotate (tail x) (n-1) ++ [head x]

    list = [5..8]
  3. dtak1114 revised this gist May 21, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rotate.hs
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    rotate x 0 = x
    rotate x n
    | n > (length x) = rotate x (mod n (length x))
    | otherwise = rotate (tail x) (n-1) ++ [head x]
    | otherwise = rotate (tail x) (n-1) ++ [head x]

    list = [5..8]
  4. dtak1114 created this gist May 21, 2013.
    6 changes: 6 additions & 0 deletions rotate.hs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    rotate x 0 = x
    rotate x n
    | n > (length x) = rotate x (mod n (length x))
    | otherwise = rotate (tail x) (n-1) ++ [head x]

    list = [5..8]