at operator return -1 when fails in lists and arrays; insert operators (<< and >>) changes che container if it is a variable

This commit is contained in:
2026-07-16 07:25:15 +02:00
parent 8c55f4ac4b
commit 2f616f349b
11 changed files with 105 additions and 60 deletions
+22
View File
@@ -186,10 +186,32 @@ func (t *Term) GetChildSource(index int) (s string) {
return
}
func (t *Term) GetLeftChild() (c kern.Term) {
if t.Position == PosInfix && len(t.Children) > 0 {
c = t.Children[0]
}
return
}
func (t *Term) GetRightChild() (c kern.Term) {
if t.Position == PosInfix && len(t.Children) > 1 {
c = t.Children[1]
}
return
}
func (t *Term) IsAssign() bool {
return t.Symbol() == SymEqual
}
func (t *Term) IsVar() bool {
return t.Symbol() == SymVariable
}
// func (t *Term) IsFunc() bool {
// return t.Symbol() == SymFunction
// }
func (t *Term) Compute(ctx kern.ExprContext) (v any, err error) {
if t.EvalFunc == nil {
err = t.Errorf("undefined eval-func for %q term", t.Source())