DEV Community 👩‍💻👨‍💻

Michael Lee 🍕
Michael Lee 🍕

Posted on

What is the "<>" operator called in Elixir?

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"
Enter fullscreen mode Exit fullscreen mode

Top comments (6)

Collapse
 
eljayadobe profile image
Eljay-Adobe

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".

Collapse
 
michael profile image
Michael Lee 🍕

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.

Collapse
 
deciduously profile image
Ben Lovy • Edited on

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.

Collapse
 
michael profile image
Michael Lee 🍕

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 :)

Collapse
 
bootcode profile image
Robin Palotai • Edited on

In Haskell, this would be called "mappend", for Monoid append.

(Actually it's Semigroup append, but don't let that bother you)

Collapse
 
michael profile image
Michael Lee 🍕

Thanks Robin for sharing!

Stop sifting through your feed.

Find the content you want to see.

Change your feed algorithm by adjusting your experience level and give weights to the tags you follow.