Fixes list-join to work without altering the lists passed in

This commit is contained in:
sloum 2022-11-08 21:16:07 -08:00
parent d033985e69
commit 39bda3b853
3 changed files with 6 additions and 5 deletions

View File

@ -17,7 +17,7 @@ gui:
${GOCMD} build -tags gui -ldflags "-w -s" -o ${BINARY}
.PHONY: install
install: install-bin install-man install-module-dir clean
install: install-bin install-man install-module-dir
install-bin: ${BINARY}
install -d ${DESTDIR}${BINDIR}
@ -35,6 +35,6 @@ install-man: ${BINARY}.1
.PHONY: clean
clean:
${GOCMD} clean
${GOCMD} clean 2> /dev/null
rm -f ./${BINARY}.1.gz 2> /dev/null
rm -f ./${BINARY}_* 2> /dev/null

5
lib.go
View File

@ -1086,14 +1086,15 @@ var stdLibrary = vars{
if !ok {
return exception("'list-join' expected a list but was given a non-list value")
}
out := DeepCopySlice(base).([]expression)
for _, v := range a[1:] {
val, ok2 := v.([]expression)
if !ok2 {
return exception("'list-join' expected a list but was given a non-list value")
}
base = append(base, val...)
out = append(out, val...)
}
return base
return out
},
"append": func(a ...expression) expression {
if len(a) == 0 {

View File

@ -18,7 +18,7 @@ import (
ln "github.com/peterh/liner"
)
const version = "1.2.8"
const version = "1.2.9"
const globalLibPath = "/usr/local/lib/slope/modules/"