new operator 'in' added. It check if an item is member of a list, or if a key is contained in a dictionary

This commit is contained in:
2024-05-18 07:47:41 +02:00
parent 14bb9e942b
commit c39970fa7e
5 changed files with 61 additions and 0 deletions
+11
View File
@@ -6,6 +6,7 @@ package expr
import (
"fmt"
"reflect"
"strings"
)
@@ -61,6 +62,16 @@ func newList(listAny []any) (list *ListType) {
return
}
func (list *ListType) indexDeepCmp(target any) (index int) {
index = -1
for i, item := range *list {
if reflect.DeepEqual(item, target) {
index = i
break
}
}
return
}
// -------- list term
func newListTermA(args ...*term) *term {