matching keywords in function headers ...

45 views
Skip to first unread message

mraptor

unread,
Nov 18, 2014, 2:53:22 PM11/18/14
to elixir-l...@googlegroups.com
Just double checking ...

I was matching keywords in the header of a function like this :

def blah([ { :k1, v1 }, { :k2, v2 } | _ ] ) do ......

for calls like this :

blah(k1: 5, k2: 7)

Now I'm matching it like this :

def blah(k1: v1, k2: v2) do ......

this is the correct way of doing it, right ?
(As long as the keywords are the last argument/s. I suppose it wont work if it is not last argument...)

José Valim

unread,
Nov 18, 2014, 3:46:35 PM11/18/14
to elixir-l...@googlegroups.com
It will work as long as you keep the same order.
--
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.
For more options, visit https://groups.google.com/d/optout.


--


José Valim
Skype: jv.ptec
Founder and Lead Developer

Reply all
Reply to author
Forward
0 new messages