OSDN Git Service

Trying out a different dsiplay format.
authorSimon Forman <sforman@hushmail.com>
Fri, 15 May 2020 14:34:47 +0000 (07:34 -0700)
committerSimon Forman <sforman@hushmail.com>
Fri, 15 May 2020 14:34:47 +0000 (07:34 -0700)
joy/gui/world.py
joy/library.py

index 098da9f..48cbbdd 100644 (file)
@@ -130,9 +130,12 @@ class StackDisplayWorld(World):
                if self.has(command) and self.check(command) == False:  # not in {True, None}:
                        return
                # print('\njoy?', command)
-               print(command)
+               self.print_command(command)
                super(StackDisplayWorld, self).interpret(command)
 
+       def print_command(self, command):
+               print(command)
+
        def print_stack(self):
                print('\n%s <-' % stack_to_string(self.stack))
 
@@ -164,7 +167,7 @@ class StackWorld(StackDisplayWorld):
                self.viewer.update_stack(self.stack)
 
        def print_stack(self):
-               # StackDisplayWorld.print_stack(self)
+               print('%s . ' % stack_to_string(self.stack), end='')
                if self.viewer:
                        self.viewer.update_stack(self.stack)
 
index 4caac57..775e67c 100644 (file)
@@ -102,6 +102,7 @@ Ns = list(map(NumberStarJoyType, _R))
 Ss = list(map(StackStarJoyType, _R))
 
 
+# "sec": stack effect comment, like in Forth.
 sec0 = stack_effect(t1)()
 sec1 = stack_effect(s0, i1)(s1)
 sec2 = stack_effect(s0, i1)(a1)
@@ -113,6 +114,7 @@ sec_unary_logic = stack_effect(a1)(b1)
 sec_unary_math = stack_effect(n1)(n2)
 sec_Ns_math = stack_effect((Ns[1], s1),)(n0)
 
+# This is the main dict we're building.
 _dictionary = {}