[erlang-questions] bitstring ets:select
Fri Nov 20 23:51:29 CET 2015
On Fri, Nov 20, 2015 at 5:42 PM, Sid Muller <sid5@REDACTED> wrote:
> Is there a way to do a select on a bitstring based on a value in ets table?
> The X:'$2'/bitstring below results in an illegal bit size, which makes
> sense because '$2' doesn't exits yet.
> How do I dynamically create that X value based on external B value and
> '$2' that will be selected from ets table? Is that even possible?
As far as I know, it is not possible. Match specs, as you may have noticed,
do not have a lot of support for working with binaries, and even if you
substitute your binary to a list, it is not possible to do what you want to
do. The language is (afaik) not powerful enough to express that kind of
If you know the length of the prefix beforehand, you could do it, but if
you don't then it becomes very hard/impossible to do with what is allowed
in match specs today.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions