Question: I have an enumerable that goes through several transformation steps and a final filter step

E.g

```
[1,2,3,4,5,6,7,8,9].map{|i| i * 2}
                   .map{|i| i * i}
                   .filter{|i| i % 3 ==0 }
                   .each{|i| puts how_do_i_get_initial_value_here }
                   .or_the_initial_value_here

```

How do I get the initial value whose transformations satisfied the filter?

Thus in the above example, how do I end up with `[3,6,9]` instead of `[36, 144, 324]`

Answer: 
You could simply apply the transformations that you do in the two `map` calls directly in `filter`:

```rb
[1,2,3,4,5,6,7,8,9]
  .filter { |i| (i * 2)**2 % 3 == 0 }

```

Alternatively, you could keep the original value in a "tuple" as follows:

```rb
[1,2,3,4,5,6,7,8,9]
  .map { |i| [i, i] }
  .map { |a, b| [a, b * 2] }
  .map { |a, b| [a, b * b] }
  .filter { |a, b| b % 3 == 0 }
  .map { |a, _| a }

```
You could just undo the things you did. So 

```
[1,2,3,4,5,6,7,8,9]
  .map{ |i| i * 2 }
  .map{ |i| i * i }
  .filter{ |i| i % 3 ==0 }
  .map{ |i| Math.sqrt(i) / 2 }

```