[erlang-questions] Proposal: add lists:intersperse/2 and lists:intercalate/2
Jesper Louis Andersen
jesper.louis.andersen@REDACTED
Mon Mar 7 16:27:30 CET 2016
On Mon, Mar 7, 2016 at 4:08 PM, Garrett Smith <g@REDACTED> wrote:
> It's vague, as is intercalculate, but as it's superficially doing what
> string "join" does with chars has some precedence within Erlang. I wouldn't
> call it hopeless.
I'm probably leaning away from using 'join' at this point, since 'join'
already have type
join :: Monad M => m (m a) -> m a
so from an FP perspective, that name is highly confusing since it is in use
in monadic context and is used to join monadic data into its own monadic
context. For a list, join is essentially 'append':
Prelude Control.Monad> join ["a", "b", "c"]
"abc"
But join is monadic, so `join $ Just Nothing` evaluates to `Nothing`.
I mean, C++ also uses the word Functor, but they know jack shit about what
that means mathematically. And almost every language knows jack shit about
what join really is either :)
--
J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160307/11335fbc/attachment.htm>
More information about the erlang-questions
mailing list