rewrite oneofakind with map since we're starting to see longer arrays
This commit is contained in:
parent
3de799b34c
commit
ec15e6041a
19
fun.go
19
fun.go
|
@ -538,18 +538,17 @@ func firstclass(honk *Honk) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func oneofakind(a []string) []string {
|
func oneofakind(a []string) []string {
|
||||||
var x []string
|
seen := make(map[string]bool)
|
||||||
for n, s := range a {
|
seen[""] = true
|
||||||
if s != "" {
|
j := 0
|
||||||
x = append(x, s)
|
for _, s := range a {
|
||||||
for i := n + 1; i < len(a); i++ {
|
if !seen[s] {
|
||||||
if a[i] == s {
|
seen[s] = true
|
||||||
a[i] = ""
|
a[j] = s
|
||||||
|
j++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return a[:j]
|
||||||
}
|
|
||||||
return x
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var ziggies = make(map[string]*rsa.PrivateKey)
|
var ziggies = make(map[string]*rsa.PrivateKey)
|
||||||
|
|
Loading…
Reference in New Issue