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

Alex Chateau <>
Fri Oct 10 14:04:01 CEST 2008


On Thu, Oct 09, 2008 at 12:53:52PM -0400, Edwin Fine wrote:
> >
> >
> > Do you mean that string:split should be the _inverse_ of string:join?
> >
> > http://en.wikipedia.org/wiki/Inverse_function
> 
> 
> Yes, that's it. Thanks. I just wish there was a more impressive-sounding
> word like idempotent :)

string:join/2 is not a surjective function, not a bijective one:

1> string:join(["a.", "b"], ".").
"a..b"
2> string:join(["a", ".b"], ".").
"a..b"

So, there is no inverse function for string:join/2 

http://en.wikipedia.org/wiki/Bijection
http://en.wikipedia.org/wiki/Surjection
 
-- 
Alex Chateau



More information about the erlang-questions mailing list