From f342dfe9f3e47b22e38aa61f9b71f33cfa935ce3 Mon Sep 17 00:00:00 2001 From: Celestino Amoroso Date: Mon, 6 May 2024 15:30:23 +0200 Subject: [PATCH] operand-list.go: ListType constructor functions newList() and newListA() --- operand-list.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/operand-list.go b/operand-list.go index c7183d8..7bea937 100644 --- a/operand-list.go +++ b/operand-list.go @@ -46,6 +46,22 @@ func (ls *ListType) String() string { return ls.ToString(0) } +func newListA(listAny ...any) (list *ListType) { + return newList(listAny) +} + +func newList(listAny []any) (list *ListType) { + if listAny != nil { + ls := make(ListType, len(listAny)) + for i, item := range listAny { + ls[i] = item + } + list = &ls + } + return +} + + // -------- list term func newListTermA(args ...*term) *term { return newListTerm(args)