Skip to content

Instantly share code, notes, and snippets.

@stepancheg
Created June 23, 2012 21:51
Show Gist options
  • Save stepancheg/2980181 to your computer and use it in GitHub Desktop.
Save stepancheg/2980181 to your computer and use it in GitHub Desktop.
define subtuple;
[n1]
overload subtuple(t, static n1, ..ns) {
return Tuple(..unpack(subtuple(t, static n1)), ..unpack(subtuple(t, ..ns)));
}
[n]
overload subtuple(t, static n) = [staticIndex(t, static n)];
main() {
var t = [17, "a", 33, "d"];
println(subtuple(t, static 3, static 2));
println([t.3, t.2]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment