Skip to content

Instantly share code, notes, and snippets.

@kunigami
Last active September 28, 2017 17:06
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 kunigami/cb0c6292ff1a10394f5ceef8bb8c0aa4 to your computer and use it in GitHub Desktop.
Save kunigami/cb0c6292ff1a10394f5ceef8bb8c0aa4 to your computer and use it in GitHub Desktop.
let rec push: 'a. 'a -> 'a seq -> 'a seq =
fun element digits -> match digits with
| Nil -> One (element, Nil)
| Zero restDigits -> One (element, restDigits)
| One (currentElement, restDigits) ->
Zero (push (element, currentElement) restDigits)
;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment