Skip to content

Instantly share code, notes, and snippets.

@nowelium
Created September 12, 2010 14:13
Show Gist options
  • Save nowelium/576139 to your computer and use it in GitHub Desktop.
Save nowelium/576139 to your computer and use it in GitHub Desktop.
//
// 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