Created
July 10, 2016 09:30
-
-
Save maticzav/f0b9177bf59d3efa44815167fd55cdf0 to your computer and use it in GitHub Desktop.
Flatten 2D list 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
import List exposing (..) | |
flatten2D : List (List a) -> List a | |
flatten2D list = | |
foldr (++) [] list | |
-- SAMPLE | |
flatten2D [[1,2],[3,4],[1,1]] == [1,2,3,4,1,1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment