From 69968caa695b5015c4cf7592da14ed7005ea0e80 Mon Sep 17 00:00:00 2001 From: HAYAMA_Kaoru Date: Mon, 2 Dec 2024 10:02:12 +0900 Subject: [PATCH] Implement `$PROGRAM_NAME` for script name --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 7ab14b6..3be582f 100644 --- a/main.go +++ b/main.go @@ -54,7 +54,10 @@ func mains(args []string) error { for _, s := range args[1:] { posixArgv = append(posixArgv, gmnlisp.String(s)) } - lisp = lisp.Let(&gmnlisp.Pair{Key: gmnlisp.NewSymbol("args"), Value: gmnlisp.List(posixArgv...)}) + lisp = lisp.Let(gmnlisp.Variables{ + gmnlisp.NewSymbol("args"): gmnlisp.List(posixArgv...), + gmnlisp.NewSymbol("$PROGRAM_NAME"): gmnlisp.String(args[0]), + }) ctx, cancel := context.WithCancel(context.Background()) _, err = lisp.Interpret(ctx, string(script))