Skip to content

Instantly share code, notes, and snippets.

@alfredbaudisch
Created March 15, 2021 12:29
Show Gist options
  • Save alfredbaudisch/b98922cc23307005ed8731c7dfc0fdcb to your computer and use it in GitHub Desktop.
Save alfredbaudisch/b98922cc23307005ed8731c7dfc0fdcb to your computer and use it in GitHub Desktop.
Elixir: using global operators in pipes
# 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