.
authorThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Tue, 2 Dec 2025 06:04:07 +0000 (06:04 +0000)
committerThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Tue, 2 Dec 2025 06:04:07 +0000 (06:04 +0000)
shared/authored/dir-walk/JSON.py
shared/authored/dir-walk/TapeMachine.py

index 7a3336a..3b910f3 100755 (executable)
@@ -20,9 +20,8 @@ def to_JSON_TM(
     - "extent": last valid index
   """
 
-  head = tm.address()
-  tm.cue_leftmost()
-  tape_data = [tm.read(n) for n in range(0 ,tm.extent + 1)]
+  tape = tm.tape()
+  tape_data = [tm.tape()[n] for n in range(0 ,len(tape.length))]
 
   obj = {
     "tape"  : tape_data
@@ -184,31 +183,7 @@ def CLI() -> None:
     - pretty
   """
   p = builtins.print
-
-  class DemoTM:
-    def __init__(self) -> None:
-      self._tape = [1 ,None ,"three"]
-      self._head_position = 1  # on the None cell
-
-    @property
-    def extent(self) -> int:  return len(self._tape) - 1
-    def address(self) -> int: return self._head_position
-    def cue_leftmost(self) -> None: self._head_position = 0
-    def can_step(self ,n: int = 1) -> bool:
-      return 0 <= self._head_position + n <= self.extent
-    def step(self ,n: int = 1) -> None:
-      self._head_position += n
-    def read(self ,n: int = 0) -> Any:
-      return self._tape[self._head_position + n]
-    def write(self ,value: Any ,n: int = 0) -> None:
-      self._tape[self._head_position + n] = value
-    def entangle(self) -> "DemoTM":
-      tm = DemoTM()
-      tm._tape = self._tape
-      tm._head_position = self._head_position
-      return tm
-
-  tm = DemoTM()
+  tm = TM_ND_A([1 ,None ,"three"])
 
   p("json.is_a_TM examples:")
   p("  is_a_TM(tm)   ->" ,is_a_TM(tm))
index abf2e9b..438e00d 100644 (file)
@@ -28,7 +28,6 @@ class TM_ND_A:
     self._head_position: int = 0
 
   # ----------------------------------------------------------------------
-  @property
   def        extent(self) -> int:  return self._extent
   def          tape(self) -> Any:  return self._tape
   def         where(self) -> int:  return self._head_position