Skip to content

Instantly share code, notes, and snippets.

@apmckinlay
Created April 19, 2014 18:55
Show Gist options
  • Save apmckinlay/11093862 to your computer and use it in GitHub Desktop.
Save apmckinlay/11093862 to your computer and use it in GitHub Desktop.
second approach
type CharMatch struct {
fn func(rune) bool
}
func (cm CharMatch) Match(c rune) bool {
return cm.fn(c)
}
func Is(c rune) CharMatch {
return CharMatch{ func (c2 rune) bool { return c == c2 }}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment