Issue 33: Finished most aspects of the expression language (#38)
- Most aspects of scans and queries can now be represented using the expression language - All constructs of the expression language can be used to evaluate items
This commit is contained in:
parent
7d2817812c
commit
917663fac0
24 changed files with 1815 additions and 370 deletions
|
|
@ -8,6 +8,19 @@ func Map[T, U any](ts []T, fn func(t T) U) []U {
|
|||
return us
|
||||
}
|
||||
|
||||
func MapWithError[T, U any](ts []T, fn func(t T) (U, error)) ([]U, error) {
|
||||
us := make([]U, len(ts))
|
||||
|
||||
for i, t := range ts {
|
||||
var err error
|
||||
us[i], err = fn(t)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return us, nil
|
||||
}
|
||||
|
||||
func Filter[T any](ts []T, fn func(t T) bool) []T {
|
||||
us := make([]T, 0)
|
||||
for _, t := range ts {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue