Last active
August 29, 2015 14:11
-
-
Save TheSeamau5/beacaccd06188453e537 to your computer and use it in GitHub Desktop.
Interleave two lists in Elm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interleave : List a -> List a -> List a | |
interleave list1 list2 = | |
case list1 of | |
[] -> list2 | |
x :: xs -> | |
case list2 of | |
[] -> list1 | |
y :: ys -> y :: x :: interleave xs ys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: