Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@monkieboy
Created February 23, 2017 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monkieboy/c367566c8f6e905620791b41c1ec74d4 to your computer and use it in GitHub Desktop.
Save monkieboy/c367566c8f6e905620791b41c1ec74d4 to your computer and use it in GitHub Desktop.
let rotateList amount initialList =
let rec rotate amount myList =
if amount = 0
then myList |> List.rev
else
let newestList =
match myList |> List.rev with
| h::rest ->
let newList = (rest@[h]) |> List.rev
rotate (amount-1) newList
| [] -> []
newestList
rotate amount initialList
let skip amount ( lst : string list ) = lst.[amount..]
let take toIndex ( lst : string list ) = lst.[..toIndex]
let range amount = [0..amount..200]
skip 2 ["a";"b";"c";"d";"e";"f"]
take 3 ["a";"b";"c";"d";"e";"f"]
range 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment