From 1376a23bda5e6fe94148cb57ca1447907c6bb21e Mon Sep 17 00:00:00 2001 From: tslil Date: Tue, 14 Oct 2025 20:48:03 +0100 Subject: Sketching the implementation of the monad and selections --- python/src/types/buffer.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 python/src/types/buffer.py (limited to 'python/src/types/buffer.py') diff --git a/python/src/types/buffer.py b/python/src/types/buffer.py new file mode 100644 index 0000000..04e1def --- /dev/null +++ b/python/src/types/buffer.py @@ -0,0 +1,16 @@ +from dataclasses import dataclass + +@dataclass +class Buffer: + content: str + + @property + def min_pos(self) -> int: + return 0 + + @property + def max_pos(self) -> int: + return len(self.content) + + def valid_pos(self, pos : int) -> bool: + return self.min_pos <= pos < self.max_pos -- cgit v1.2.3