Created
September 12, 2010 14:13
-
-
Save nowelium/576139 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
// | |
// js port scala's Tuple2 | |
// | |
var Tuple2 = function(arg1, arg2) { | |
var self = (this == window) ? {} : this; | |
self._1 = arg1; | |
self._2 = arg2; | |
return self; | |
} | |
// | |
// example | |
// | |
var a = Tuple2('hello', 'world') | |
log(a._1); // => 'hello' | |
log(a._2); // => 'world' | |
var b = new Tuple2('foo', 'bar') | |
log(b._1); // => 'foo' | |
log(b._2); // => 'world' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment