Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport for list multiplication like in Python #580
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
jvoigtlaender
Apr 29, 2016
Contributor
Please read https://github.com/elm-lang/core/blob/master/CONTRIBUTING.md#adding-new-functions and follow what is said there. That is, bring this up as an issue or pull request in https://github.com/elm-community/elm-list-extra first instead.
|
Please read https://github.com/elm-lang/core/blob/master/CONTRIBUTING.md#adding-new-functions and follow what is said there. That is, bring this up as an issue or pull request in https://github.com/elm-community/elm-list-extra first instead. |
jvoigtlaender
closed this
Apr 29, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ebekebe commentedApr 29, 2016
•
edited
Edited 1 time
-
ebekebe
edited Apr 29, 2016 (most recent)
In Python you can write
2 * ['a', 'b']which will result in
['a', 'b', 'a', 'b']. This is a useful operation for initializing large lists. For example,100 * [0]will give me a zero vector with 100 dimensions. I used this method on a regular basis in Python and would love to see it included in Elm's basics.I propose the following implementation draft
This enables a similar syntax as in python and is fit for "piping":
What do you think? Would you like to see this in Elm, too?