exercism/go/custom-set/cmd/main.go

30 lines
485 B
Go
Raw Normal View History

2016-08-15 19:08:39 +00:00
package main
import (
"fmt"
"../../custom-set"
)
func main() {
fmt.Println("Creating Set 1")
2016-08-16 18:58:10 +00:00
s1 := stringset.NewFromSlice([]string{"a"})
addAndOutput(s1, "b")
addAndOutput(s1, "d")
2016-08-23 20:47:19 +00:00
addAndOutput(s1, "c")
2016-08-16 18:58:10 +00:00
s1.PrettyPrint()
return
addAndOutput(s1, "0")
addAndOutput(s1, "aa")
addAndOutput(s1, "aaa")
2016-08-15 19:08:39 +00:00
}
2016-08-16 18:58:10 +00:00
func addAndOutput(s stringset.Set, val string) {
fmt.Println("Adding new value: " + val)
2016-08-15 19:08:39 +00:00
s.Add(val)
}
2016-08-16 18:58:10 +00:00
func delAndOutput(s stringset.Set, val string) {
2016-08-15 19:08:39 +00:00
s.Delete(val)
}