[erlang-questions] idea: service pack one
Thu Nov 15 13:41:00 CET 2007
Joel Reymont <> writes:
> The difference seems to be in matching an empty binary vs <<_Head:N/
> Why exactly is the 2nd pattern so much faster?
The first pattern (<<>>) does not match. That was worked around (by the original
author) by adding the following clause:
index(Str, _Char, N) when N > size(Str) ->
What I did what to make sure that the pattern could match (<<_Head:N/binary>>),
and comment out the now redundant second clause.
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-questions