Created
February 8, 2011 18:05
-
-
Save Dykam/816870 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| list = [0...10] | |
| otherList = [0...10] | |
| zip = (arrays...) -> | |
| length = 0 | |
| for array in arrays when array.length > length | |
| length = array.length | |
| for i in [0...length] | |
| array[i] for array in arrays | |
| Array::zip = (arrays...) -> | |
| zip this, arrays... | |
| Array::equals = (that) -> | |
| for [a, b] in @zip that when a isnt b | |
| return false | |
| return true | |
| console.log list.equals otherList | |
| console.log list.zip otherList | |
| console.log zip [0,1,2], [4,5,6], [7,8,9] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment