linked-list supports index assign and concatenation

This commit is contained in:
2026-07-13 11:34:25 +02:00
parent 072fd9af39
commit 4df222496d
7 changed files with 52 additions and 29 deletions
+7
View File
@@ -15,6 +15,7 @@ import (
"git.portale-stac.it/go-pkg/expr/types/dict"
"git.portale-stac.it/go-pkg/expr/types/float"
"git.portale-stac.it/go-pkg/expr/types/fract"
"git.portale-stac.it/go-pkg/expr/types/list"
"git.portale-stac.it/go-pkg/expr/types/str"
)
@@ -50,6 +51,12 @@ func sumValues(plusTerm *scan.Term, leftValue, rightValue any) (v any, err error
sumList = append(sumList, *leftList...)
sumList = append(sumList, *rightList...)
v = &sumList
} else if list.IsLinkedList(leftValue) && list.IsLinkedList(rightValue) {
lsLeft := leftValue.(*list.LinkedList)
lsRight := rightValue.(*list.LinkedList)
ls := lsLeft.Clone()
ls.SeqPushBack(NewLinkedListIterator(lsRight, nil))
v = ls
} else if (fract.IsFraction(leftValue) && types.IsNumber(rightValue)) || (fract.IsFraction(rightValue) && types.IsNumber(leftValue)) {
if float.IsFloat(leftValue) || float.IsFloat(rightValue) {
v = types.NumAsFloat(leftValue) + types.NumAsFloat(rightValue)