Created
March 15, 2021 12:29
-
-
Save alfredbaudisch/b98922cc23307005ed8731c7dfc0fdcb to your computer and use it in GitHub Desktop.
Elixir: using global operators in pipes
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
# To concat to lists, you normally do: | |
list = [1] | |
list ++ [2] | |
# result: [1, 2] | |
# How do you do that in pipelines? | |
# Global operators are under the Kernel module, so you can use them with the pipe operator. | |
list |> Kernel.++([2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment