Skip to content

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