I have some problems getting a couple of elements working right... I
have 2 small issues:
1. Trying to remove the first and last element in an array in Ruby:
def remove_ends(a)
a.pop
a.shift
end
I need out put like:
Input array: [1,2,3,4]
Output: [2,3]
This seems like I'm stumbling on how to reference the array that is
being processed rather than the original??
2. I'm trying to interleave 2 arrays. I've seen some examples online but
I need to keep the arguments (a,b) and other examples don't have 2
inputs.
I'm pretty close:
a.zip(b)
join
It interleaves just fine.. but I need the output to be 1 string:
"a1b2c3d4" I'm not sure how to get to the array created to use JOIN.
I have some problems getting a couple of elements working right... I
have 2 small issues:
1. Trying to remove the first and last element in an array in Ruby:
def remove_ends(a)
a.pop
a.shift
end
I need out put like:
Input array: [1,2,3,4]
Output: [2,3]
This seems like I'm stumbling on how to reference the array that is
being processed rather than the original??
What exactly is your problem?
2. I'm trying to interleave 2 arrays. I've seen some examples online but
I need to keep the arguments (a,b) and other examples don't have 2
inputs.
I'm pretty close:
a.zip(b)
join
It interleaves just fine.. but I need the output to be 1 string:
"a1b2c3d4" I'm not sure how to get to the array created to use JOIN.
What's wrong with a.zip(b).join ?
Cheers
rober
···
On Wed, Dec 14, 2011 at 3:42 AM, matha wasint <sherri@vsoundinc.com> wrote: