From 914bf672336c4a4185f3b2ab24ff804d9df15632 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Tue, 2 Dec 2025 06:04:07 +0000 Subject: [PATCH] . --- shared/authored/dir-walk/JSON.py | 31 +++---------------------- shared/authored/dir-walk/TapeMachine.py | 1 - 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/shared/authored/dir-walk/JSON.py b/shared/authored/dir-walk/JSON.py index 7a3336a..3b910f3 100755 --- a/shared/authored/dir-walk/JSON.py +++ b/shared/authored/dir-walk/JSON.py @@ -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)) diff --git a/shared/authored/dir-walk/TapeMachine.py b/shared/authored/dir-walk/TapeMachine.py index abf2e9b..438e00d 100644 --- a/shared/authored/dir-walk/TapeMachine.py +++ b/shared/authored/dir-walk/TapeMachine.py @@ -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 -- 2.20.1