From 608ab4ab67ecb314f7282246e6c1b7bc328ec359 Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Sun, 19 May 2024 14:54:51 -0400 Subject: [PATCH] stringify fns and bugfixes --- janet/interpreter.janet | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/janet/interpreter.janet b/janet/interpreter.janet index bc4ecbb..09e3613 100644 --- a/janet/interpreter.janet +++ b/janet/interpreter.janet @@ -221,9 +221,11 @@ ", ")) (defn- stringify* [value] - (def typed? (when (dictionary? value) (value :^type))) - (def type (if typed? typed? (type value))) (print "stringifying " (string value)) + (def typed? (when (dictionary? value) + (print "value is a dictionary") + (value :^type))) + (def type (if typed? typed? (type value))) (case type :nil "" :number (string value) @@ -238,6 +240,7 @@ :set (string/join (map stringify (keys value)) ", ") :ref (stringify (value :^value)) + :fn (string "fn " (value :name)) # XXX: pkg, fn )) @@ -502,10 +505,9 @@ (do (set source ` -fn foo () -> :foo -let bar = #{foo} -bar :foo () +#{:a 1, :b 2} `) (def result (run)) +(stringify result) )