Skip to content

Instantly share code, notes, and snippets.

@strager
Last active December 20, 2015 09:29
Show Gist options
  • Save strager/6107955 to your computer and use it in GitHub Desktop.
Save strager/6107955 to your computer and use it in GitHub Desktop.
function tuple(/* ... */) {
var args = arguments;
return function unpackTuple(f) {
return f.apply(this, args);
};
}
var t = tuple(1, 2, 3);
t(function (a, b, c) {
return {a:a, b:b, c:c};
});
// => {a:1, b:2, c:3}
t(Array); // Be careful with one-element tuples!
// => [a, b, c]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment