-
-
Save pyar6329/f5b669a7a398e357e9f622889b62b14b to your computer and use it in GitHub Desktop.
Flatten 2D list in Elm
This file contains 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