Last active
July 29, 2020 17:03
-
-
Save yakkomajuri/18da6589f60eb490f5912883dbb9e008 to your computer and use it in GitHub Desktop.
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
(x, y, z) = (4, 5, 6) | |
(x:xs) = [1, 2, 3, 4] | |
(x, y) = (4, 5) |
Thanks for that! I've never used Haskell myself so this script was directly copied from the original poster. Will correct it!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
List unpacking (second line) should be
(x:xs)
.The cons in between x and xs are actually a function:
and part of the constructors of the list type. (The other being Nil / the empty list /
[]
)So
(x:xs)
"undoes" the last construction step of the linked list to yield an element of the list and whatever the rest of the list constructed until there is.