diff --git a/joy/gui/world.py b/joy/gui/world.py index 098da9f..48cbbdd 100644 --- a/joy/gui/world.py +++ b/joy/gui/world.py @@ -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) diff --git a/joy/library.py b/joy/library.py index 4caac57..775e67c 100644 --- a/joy/library.py +++ b/joy/library.py @@ -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 = {}