# Re: symbol tricks

**URL:** <https://www.ruby-forum.com/t/re-symbol-tricks/68045>\
**Category:** Ruby\
**Created:** [September 8, 2006, 6:52pm UTC](https://www.ruby-forum.com/t/re-symbol-tricks/68045 "2006-09-08T18:52:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [September 8, 2006, 6:52pm UTC](https://www.ruby-forum.com/t/re-symbol-tricks/68045/1 "2006-09-08T18:52:39Z")

</div>

From: Jason N. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

> Plus for arrays and strings is concatenation. I don’t like it  
> either, b/c array plus should be addition of corresponding  
> elements, but that is the way things are.

That’s seems oddly specific to me, but if you don’t like it, change it:

a = [1, 2, 3]  
b = [4, 5, 6]  
p a+b  
#=\> [1, 2, 3, 4, 5, 6]

class Array  
def +( other )  
self.zip( other ).map{ |e| e[0]+e[1] }  
end  
end

p a+b  
#=\> [5, 7, 9]

---

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [September 8, 2006, 7:30pm UTC](https://www.ruby-forum.com/t/re-symbol-tricks/68045/2 "2006-09-08T19:30:43Z")

</div>

Gavin K. wrote:

> From: Jason N. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]
> 
> > Plus for arrays and strings is concatenation. I don’t like it  
> > either, b/c array plus should be addition of corresponding  
> > elements, but that is the way things are.
> 
> That’s seems oddly specific to me, but if you don’t like it, change it:

Wouldn’t that break pretty much everything else that used + for  
concatenation?

-j

>
