Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

Added method to ZIP multiple arrays #60

Open
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

isaacroldan
Copy link

Added method to zip elements passing an array of arrays that returns another array of arrays zipped.
This method only works if all the sub-arrays have the same length (should i add some checks here?)

this:

@[@[@1, @2, @3], @[@4, @5, @6], @[@7, @8, @9]]

transforms into this:

@[@[@1, @4, @7], @[@2, @5, @9], @[@3, @6, @9]]

⚠️ all the arrays should have the same lenght

I would like to add specs, but can't make the tests run. Always getting this error after pod install:

ld: library not found for -lPods-UnderscoreTests-Expecta
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@masylum
Copy link

masylum commented Feb 23, 2015

ohh yess!

@kvnify
Copy link
Collaborator

kvnify commented Jan 22, 2016

If you merge in my release branch updates you should be able to get tests running. Also the development branch already has a zipWith method added. Is that the same as what you are proposing or different?

@@ -243,6 +243,19 @@ - (USArrayWrapper *)shuffle
};
}

- (USArrayWrapper *)zip
{
int length = (int)[self.first count];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be using NSInteger.

@kvnify kvnify self-assigned this Jan 24, 2016
@kvnify kvnify added this to the 0.4.0 milestone Jan 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants