Groups
Groups
Sign in
Groups
Groups
elixir-lang-talk
Conversations
About
Send feedback
Help
Re: [elixir-talk:13107] bind a pattern matching in a function declaration
29 views
Skip to first unread message
Rickard Andersson
unread,
May 16, 2016, 5:37:35 AM
5/16/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to elixir-l...@googlegroups.com
Yes, as follows:
def my_function([head | tail] = list) do
# use whichever part you want
end
// gonz
On Mon, May 16, 2016 at 02:25:24AM -0700, hdcos wrote:
> Hello there :),
>
> is it possible to do something like this:
>
> def my_function([hd | tail] as my_list) do
> #use my_list hd and tail
> end
>
>
> --
> You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
elixir-lang-ta...@googlegroups.com
.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-talk/6cdde1fa-29e8-45c6-8566-00636061558f%40googlegroups.com
.
> For more options, visit
https://groups.google.com/d/optout
.
Reply all
Reply to author
Forward
0 new messages