Skip to content

Instantly share code, notes, and snippets.

@b4284
Created July 31, 2014 15:54
Show Gist options
  • Save b4284/167ed3b67242d464f152 to your computer and use it in GitHub Desktop.
Save b4284/167ed3b67242d464f152 to your computer and use it in GitHub Desktop.
var repeat = function(x, i) {
if (i === 0) {
return "";
} else {
return x + repeat(x, i - 1);
}
};
var g = (function() {
var i = 0;
var q = function(x) {
if (x === "al") {
return "g" + repeat("o", i) + "al";
} else {
i += 1;
return q;
}
};
return q;
})();
print(g()()("al"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment