checking for unbound?

Andy Kriger <>
Sat Nov 20 15:18:03 CET 2010


Is there a way to test if a variable is unbound?

I thought I could do something clever like...
[E|EL] = mnesia:dirty_index_read(myTable, value, indexField),
if <E is unbound> -> do something; % nothing was returned
  length(EL) > 0 -> do something; % more than 1 item was returned
  <E matches pattern> -> do something; % a match was returned
  true -> do something % whatever is left
end

But I don't see a way to make the first test.


More information about the erlang-questions mailing list