Erlang Efficiency quesitons

Ulf Wiger <>
Thu Mar 15 12:50:11 CET 2001


On Thu, 15 Mar 2001, Klacke wrote:

>I'll attach it here, It's written in our original
>bit syntax and it woun't compile today.

One thing that could be done right now is to provide a BIF which
is equivalent to your bstring:chr(Char, Binary) function, i.e.
return the position of the first location of Char in Binary
(or 0 if Char was not found.)

Since the current bit syntax doesn't allow constructs like:

chr(S, C) when binary(S) ->
    case S of
        <_:Size/binary, C:8/char |_> ->
            Size + 1;
        _ ->
            0
    end.

then perhaps the string:str/2 function should also have a BIF
equivalent for binaries?

and, while we're at it, a binary:reverse(Binary) BIF would also
be useful.

/Uffe
-- 
Ulf Wiger                                    tfn: +46  8 719 81 95
Senior System Architect                      mob: +46 70 519 81 95
Strategic Product & System Management    ATM Multiservice Networks
Data Backbone & Optical Services Division      Ericsson Telecom AB






More information about the erlang-questions mailing list