# Manipulaton of Rings

**URL:** <https://in-thread.sonic-pi.net/t/manipulaton-of-rings/1564>\
**Category:** Support, Help & Resources\
**Created:** [October 11, 2018, 7:45pm UTC](https://in-thread.sonic-pi.net/t/manipulaton-of-rings/1564 "2018-10-11T19:45:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/martin/32/157_2.png) [@Martin](https://in-thread.sonic-pi.net/u/Martin)\
**Post date:** [October 11, 2018, 7:45pm UTC](https://in-thread.sonic-pi.net/t/manipulaton-of-rings/1564/1 "2018-10-11T19:45:04Z")

</div>

Hi,

I am trying to figure out the following:

I want an easy way to create a ring such as

```ruby
(ring 1, 2, 2, 3, 3, 4, 4, 5)

```

My idea is firsty to make a line

```ruby
r = (line 1,5)

```

double secondly all values of the resulting ring:

```ruby
s = r.? # result shoud be => (ring 1, 1, 2, 2, 3, 3, 4, 4)

```

and then thirdly get rid of the first and the last element:

```ruby
s.drop(0).butlast

```

But I don’t know how to achieve step number 2. Can anybody help?

Cheers  
Martin

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [October 11, 2018, 10:21pm UTC](https://in-thread.sonic-pi.net/t/manipulaton-of-rings/1564/2 "2018-10-11T22:21:30Z")

</div>

How about this:

```ruby
(range 2, 5).stretch(2).unshift(1).push(5)

```

---

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/martin/32/157_2.png) [@Martin](https://in-thread.sonic-pi.net/u/Martin)\
**Post date:** [October 12, 2018, 6:50am UTC](https://in-thread.sonic-pi.net/t/manipulaton-of-rings/1564/3 "2018-10-12T06:50:09Z")

</div>

Great!

Actually I would prefer:

```ruby
(line 1,5).stretch(2).drop(1).butlast

```

But that seems to only be a matter of personal taste and memorability.

With `stretch` you did get me going! Thanks!
