Created
April 19, 2014 18:55
-
-
Save apmckinlay/11093862 to your computer and use it in GitHub Desktop.
second approach
This file contains hidden or 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
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