[eeps] EEP 31

Fredrik Svahn fredrik.svahn@REDACTED
Thu Dec 10 22:29:41 CET 2009


Hi,

Is there any chance of allowing part/[2,3] to be used as a guard? For tuples
there is already element/2. Something like the following would be very
useful:

my_func(Pos, Bin, Pattern) when binary:part(Bin, Pos, size(Pattern)) ==
Pattern ->
    ...

Another nice to have would be a diff function returning either the first
position where a list of binaries differ, or a tuple with the common
beginning and the differing ends of the binaries, e.g.

binary:diff([<<"abcde">>, <<"abcdghie">>]) -> 4, or
binary:diff([<<"abcde">>, <<"abcdghie">>]) -> {<<"abcd">>, <<"e">>,
<<"ghie">>}

The name diff might be somewhat misleading, maybe
longest_common_prefix/suffix is more descriptive (borrowed from Joe
Armstrongs elib_misc)?

BR /Fredrik




On Thu, Nov 26, 2009 at 3:25 PM, Patrik Nyblom <pan@REDACTED> wrote:

> A new EEP is submitted.
>
> EEP 31 is a slight rework of a part of EEP 9.
>
> Comments on this EEP are accepted until 10-Dec-2009. Please send all
> comments and suggestions to this mailing list (eeps@REDACTED).
>
> Best regards,
>
> /The OTP team/Patrik
>
> ________________________________________________________________
> eeps mailing list. See http://www.erlang.org/faq.html
> eeps (at) erlang.org
>
>


More information about the eeps mailing list