Skip to content

Instantly share code, notes, and snippets.

@cohalz
Last active January 4, 2016 13:49
Show Gist options
  • Save cohalz/8630407 to your computer and use it in GitHub Desktop.
Save cohalz/8630407 to your computer and use it in GitHub Desktop.
let rec take lst n =
match (lst,n) with
| ([],_) -> []
| (x::xs,m) -> if m <= 0 then [] else x::(take xs) (m-1)
let rec drop lst n =
match (lst,n) with
| ([],_) -> []
| (x::xs,m) -> if m > 1 then take xs (m-1) else xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment