Skip to content

zip and gzip method which works like python's itertools.zip and izip. #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

zip and gzip method which works like python's itertools.zip and izip. #13

wants to merge 2 commits into from

Conversation

HennyH
Copy link

@HennyH HennyH commented Jun 1, 2014

This branch adds the useful zip and gzip methods which are functionally equivalent of python's itertools libraries' zip and izip respectively.

For example:

> l = { {'a','b'}, {'c','d'} }
> r = { {1, 2}, {3, 4} }
> zipped = __.zip(l, r)

Results in zipped having:

{
    { 
        { "a", "b" }, { 1, 2 } 
    }, 
    { 
        { "c", "d" }, { 3, 4 } 
    } 
}

And then gzip:

> for li, ri in __.gzip(l, r) do print("Recieved", inspect(li), " , ", inspect(ri)) end
Recieved        { "a", "b" }     ,      { 1, 2 }
Recieved        { "c", "d" }     ,      { 3, 4 }

I have also added a line to spec_helper so it picks up the underscore.lua in the lib folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant