[erlang-questions] [enhancement] string:split/2

Richard O'Keefe ok@REDACTED
Thu Oct 9 06:37:11 CEST 2008


Colour me stupid.
I just realised, 40+ minute late,
what Fine meant about "idempotent" and why it matters.

The requirement is that
    for all strings String and Separator
        for all Substring <- unjoin(String, Separator)
            unjoin(Substring, Separator) =:= [Substring]

This _isn't_ idempotence, but it's some sort of cousin
to it.  And this is why unjoin("abc", "") doesn't
include empty matches at the beginning and end, so that
unjoin("a", "") =:= ["a"].





More information about the erlang-questions mailing list