Skip to content

Instantly share code, notes, and snippets.

@Daiz
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Daiz/cac4f25cc0c3ae039649 to your computer and use it in GitHub Desktop.
Save Daiz/cac4f25cc0c3ae039649 to your computer and use it in GitHub Desktop.
function g(a,b,c) {
c = !!+this;
if(!a && !b && !c) return g.bind(1,'go');
if( a && !b && !c) return 'g' + a;
if( a && !b && c) return g.bind(1,a + 'o');
if( a && b && c) return a + b;
}
function g(a,b) {
if(!+this) return a ? 'g' + a : g.bind(1,'go');
else return b ? a + b : g.bind(1,a + 'o');
}
function g(a,b) {
if(!+this) { b = a; a = 'g' }
return b ? a + b : g.bind(1, a + 'o');
}
function g(a,b){if(!+this)b=a,a='g';return b?a+b:g.bind(1,a+'o')}
// this was my shortest result
function g(a,b){return +this||(b=a,a='g'),b?a+b:g.bind(1,a+'o')}
var s='g',g=function(x){return x?[s+x,s='g'][0]:(s+='o',g)}
var g=(function k(s){return s?this+s:k.bind(this+'o')}).bind('g')
var test = function(){
var tmp = g()();
console.log(g('al'),g()('al'),tmp('al'),g()()()('al'));
}
console.log(g('al'),g()('al'),g()()()('al'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment