variable '_' is unbound
Vance Shipley
vances@REDACTED
Tue May 28 18:54:32 CEST 2002
On Tue, May 28, 2002 at 08:36:08AM +0200, Lennart Öhman wrote:
>
> the compiler complains because you are trying to use ==
> for matching. In a test, both sides must be bound.
I's like to be able to cover both cases inn the same clause.
Other wise I'm just making two copies of a large chunk of
code which is both wasteful and error prone.
What I really have is:
foo(bar) ->
...
foo(<<_:3, 1:1, _:12>>) ->
...
So I tried:
foo(Arg) when bar == Arg; <<_:3, 1:1, _:12>> == Arg ->
I reallu just need to test one bit in the middle of this binary.
I guess I need a strategy that doesn't require binding a variable.
-Vance
More information about the erlang-questions
mailing list