mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-09 03:49:27 +00:00
Implement file filters via dbus
This commit is contained in:
parent
0a9d83e11b
commit
ebe9842291
3 changed files with 76 additions and 8 deletions
|
|
@ -158,6 +158,18 @@ func StableSort[T any](s []T, cmp func(a, b T) int) []T {
|
|||
return s
|
||||
}
|
||||
|
||||
func Uniq[T comparable](s []T) []T {
|
||||
seen := NewSet[T](len(s))
|
||||
ans := make([]T, 0, len(s))
|
||||
for _, x := range s {
|
||||
if !seen.Has(x) {
|
||||
seen.Add(x)
|
||||
ans = append(ans, x)
|
||||
}
|
||||
}
|
||||
return ans
|
||||
}
|
||||
|
||||
func sort_with_key[T any, C constraints.Ordered](stable bool, s []T, key func(a T) C) []T {
|
||||
type t struct {
|
||||
key C
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue