Skip to content

Instantly share code, notes, and snippets.

@d0rc
Created March 9, 2014 19:27
Show Gist options
  • Select an option

  • Save d0rc/9453148 to your computer and use it in GitHub Desktop.

Select an option

Save d0rc/9453148 to your computer and use it in GitHub Desktop.
lc cid inlist([398, 980, 810]) do
def list(unquote(cid)), do: unquote(@providers |> Enum.filter(fn
[id: _, name: _, currency: c_id, pattern: _, placeholder: _] when c_id = cid -> true;
_ -> false;
end))
end
lc cid inlist([398, 980, 810]) do
def list(unquote(cid)), do: unquote(@providers |> Enum.filter(fn
[id: _, name: _, currency: ^cid, pattern: _, placeholder: _] -> true;
_ -> false;
end))
end
@bitwalker
Copy link

Oh damn, it should be curr == unquote(cid). Sorry.

@d0rc
Copy link
Author

d0rc commented Mar 9, 2014

lc cid inlist([398, 980, 810]) do
    def list(unquote(cid)), do: unquote(@providers |> Enum.filter(fn 
        [id: _, name: _, currency: currencyid, pattern: _, placeholder: _] when currencyid = unquote(cid) -> true; 
        _ -> false; 
    end))
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment