[erlang-questions] erlang-questions Digest, Vol 17, Issue 45

Edwin Fine erlang-questions_efine@REDACTED
Fri Oct 10 04:11:04 CEST 2008


On Thu, Oct 9, 2008 at 7:51 PM, Richard O'Keefe <ok@REDACTED> wrote:

> I note that "explode" has historically meant
> "to break a string (or equivalent) into a list of its
>  single-character elements",
> which is not all that split/unjoin does.
>
> Some of the names in the 'lists' module were copied
> from Haskell.  It's a pity that Haskell's "splitAt"
> was copied as "split".
>
> I dare say Ruby and PHP (?) got the name 'split'
> from Perl, which got it from 'AWK', where a
> *regular expression* controls the splitting.


I am sure they did.

>
> This is the other reason for preferring to call the
> operation 'unjoin': anyone familiar with "split" in
> AWK, Perl, &c will expect string:split/2 to take a
> regular expression parameter, and this one DOESN'T.


Ok, then to preserve the Principle Of Least Astonishment, let string:split
accept a regular expression, which is just a string with special RE
operators. If the string contains no RE operators, use an optimized special
case of split (like the one you wrote) that does not use an RE engine. Get
the best of both worlds.


> There is, or should be, a regular pattern
>        words <-> unwords
>        lines <-> unlines
>        unjoin <-> join
> Oh well, sort of regular...
>

Sorry, and no offense meant, but that's really horribly ugly. Reminds me of
that sentence, "A not unblack dog chased a not unbrown rabbit across a not
ungreen field." Should the opposite of down then be "undown"? Languages
(well, I can vouch for two, anyway) contain many complementary words that
are not syntactically constructable by adding or removing "un-". Like split
and join, for example. Hard and soft. Big and small. Break and mend. Wake
and sleep.



> When I clicked on the Documentation link on the scutil page,
> I got to some sort of Wiki thingie, with no documentation
> that I could see.
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081009/07452563/attachment.htm>


More information about the erlang-questions mailing list