# Array resizing

**URL:** <https://rubytalk.org/t/array-resizing/26187>\
**Category:** ruby-talk\
**Created:** [28 March 2006 14:08 UTC](https://rubytalk.org/t/array-resizing/26187 "2006-03-28T14:08:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kroeger\_Simon\_ext](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@Kroeger\_Simon\_ext](https://rubytalk.org/u/Kroeger_Simon_ext)\
**Post date:** [28 March 2006 14:08 UTC](https://rubytalk.org/t/array-resizing/26187/1 "2006-03-28T14:08:06Z")

</div>

> From: Victor Shepelev [mailto:vshepelev@imho.com.ua]
> 
> Sounds reasonable.  
> I can tell when I stumbled upon need for \_\_resizing\_\_ aray:  
> when tried to  
> use Array#transpose - it can't process  
> [  
> [1,2,3],  
> [1],  
> [1,2,3,4]  
> ]

a = [[1,2,3], [1], [1,2,3,4]]  
p SyncEnumerator.new(\*a).map{|s| s}  
#=\> [[1, 1, 1], [2, nil, 2], [3, nil, 3], [nil, nil, 4]]

> I think, it isn't sole case, when we can want having array of  
> arbitrary  
> size.

At least an Array#resize wouldn't hurt.

> \> David
> 
> Victor.

cheers

Simon

---

<div class="post-metadata">

**Author:** ![Marcin\_Mielzynski](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Marcin\_Mielzynski](https://rubytalk.org/u/Marcin_Mielzynski)\
**Post date:** [28 March 2006 15:33 UTC](https://rubytalk.org/t/array-resizing/26187/2 "2006-03-28T15:33:56Z")

</div>

Kroeger, Simon (ext) wrote:

> At least an Array#resize wouldn't hurt.

maybe Array#size= would be more Rubyesque 😃

lopex
