Created
July 26, 2014 15:51
-
-
Save rossdylan/1e238390162eedd45fb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "strings" | |
import "fmt" | |
var lol string | |
type g_func func(...string) g_func | |
func (gf g_func) String() string { | |
return lol | |
} | |
func g(args ...string) g_func{ | |
if len(args) > 0 && args[len(args) - 1] == "al" { | |
lol = "g" + strings.Join(args, "") | |
return func(new_args ...string) g_func { | |
return nil | |
} | |
} else { | |
return func(new_args ...string) g_func{ | |
return g(append(append(args, "o"), new_args...)...) | |
} | |
} | |
} | |
func main() { | |
fmt.Println(g()("al")) | |
fmt.Println(g()()("al")) | |
fmt.Println(g()()()("al")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment