I'm reading over the Elixir guides and recently came across the various operators. One of which is the <>
operator used to concatenate two stings. It doesn't mention a name for the operator though. And it's my first time seeing that in any language.
"Hello" <> " World"
"Hello World"
Top comments (6)
I'd call
<>
the "concatenation operator" or "string concatenation operator", which is what the Elixir documentation refers to it as.If speaking causally, I might call it "cat", "concat", or "join".
Makes sense. The docs seems to use symbols to describe how to do something versus the need to name everything. Looking over the doc I noticed other things such as
++
to combine lists. I suppose you could infer that it's called plus plus but really the symbol is used to describe what it does.In my head I just call it the "string concatenation operator", I've also never seen any official name for it. I don't believe it's used for anything else.
Yeah, I figured it's more of a symbol to represent a function or utility to do something. Just wasn't sure if it had a name. Looking over the doc I realized there's a lot of other symbols used to do things but don't actually have names such as
++
use to combine lists.Think I'll probably be calling it that in my head as well :)
In Haskell, this would be called "mappend", for Monoid append.
(Actually it's Semigroup append, but don't let that bother you)
Thanks Robin for sharing!