From fe5afcb345561eb8c14092d0de19edd92e8cc243 Mon Sep 17 00:00:00 2001 From: Aidan Date: Sun, 21 Jun 2020 13:13:46 -0700 Subject: [PATCH] update stdlib append after testing --- ast/eval.go | 2 +- ast/print.go | 3 ++- stdlib/list.go | 7 +++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ast/eval.go b/ast/eval.go index 7525fd5..621372e 100644 --- a/ast/eval.go +++ b/ast/eval.go @@ -56,7 +56,7 @@ func (t *Token) Eval(funcs FuncTable, vars VarTable) *Token { if f == nil { if !eligibleForSystemCall { log.Log(log.DEBUG, - "could not find definition for symbol " + ret.Inner.(string), + "could not find definition for symbol " + ret.Inner.(string), "eval") return nil } diff --git a/ast/print.go b/ast/print.go index 11f81a4..68c7c81 100644 --- a/ast/print.go +++ b/ast/print.go @@ -38,7 +38,8 @@ func (t *Token) String() string { for i := t.Inner.(*Token); i != nil; i = i.Next { repr = repr + i.String() + " " } - return repr + ")" + // remove trailing space + return repr[:len(repr)-1] + ")" case SYMBOL: return "<" + t.Inner.(string) + ">" diff --git a/stdlib/list.go b/stdlib/list.go index d9ad627..e7ec153 100644 --- a/stdlib/list.go +++ b/stdlib/list.go @@ -45,9 +45,8 @@ func l_append(input *ast.Token, vars ast.VarTable, funcs ast.FuncTable) *ast.Tok src := input if input.Tag != ast.LIST { - // TODO: Position, if I can figure out what to do with it - src = &ast.Token{Tag: ast.LIST, Inner: input} - return src + // TODO: position?? + return input } // deref inner first @@ -63,5 +62,5 @@ func l_append(input *ast.Token, vars ast.VarTable, funcs ast.FuncTable) *ast.Tok } (*iter).Next = input.Next - return src + return *iter }