Skip to content

Instantly share code, notes, and snippets.

@rossdylan
Created July 26, 2014 15:51
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 rossdylan/1e238390162eedd45fb1 to your computer and use it in GitHub Desktop.
Save rossdylan/1e238390162eedd45fb1 to your computer and use it in GitHub Desktop.
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