Not saying this is a great idea, but I'm working with a pattern where a 
parameter can be a module or a string.  The gist is:

def do_it(data, foo) when is_bitstring(foo), do: data
def do_it(data, foo) do
  foo.do_other_thing(data)
end

Works great, but what if I want to allow actual atoms to be used, similar 
to strings?  How can I identify the difference between an actual atom, like 
:bar, and a module, like Bar?

is_atom() returns true for both cases (makes sense because module names are 
basically atoms, :"Elixir.Bar")  Is there a way to tell the difference with 
a guard?

If not a guard, some Kernel or Module function?

...Paul


-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-talk/6278467d-e072-4ecd-995f-130fc93ad8c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to