From c6939d3bc658347f4ee1b1b687f91e9428a59b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 9 Dec 2023 00:14:34 +0100 Subject: Rework namespaced sxml type. Still incomplete. --- module/hnh/util/table.scm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'module/hnh') diff --git a/module/hnh/util/table.scm b/module/hnh/util/table.scm index 67125c8d..94d3c110 100644 --- a/module/hnh/util/table.scm +++ b/module/hnh/util/table.scm @@ -16,6 +16,8 @@ (tree-remove . table-remove) (tree->list . table->list) (tree? . table?) + (tree-empty? . table-empty?) + (tree-equal? . table-equal?) (serialize-tree . serialize-table) (alist->tree . alist->table))) @@ -55,6 +57,14 @@ (or (tree-node? x) (tree-terminal? x))) +(define (tree-empty? x) + (tree-terminal? x)) + +(define (tree-equal? a b) + (or (and (tree-terminal? a) (tree-terminal? b)) + (tree-equal? (left a) (left b)) + (tree-equal? (right a) (right b)))) + ;;; A lens ;;; This function (tree-focus) ;;; returns a function (f), @@ -70,11 +80,11 @@ (cond ((tree-terminal? tree) ;; new node (tree-node key: k value: (op 'not-a-value))) ((eq? k (key tree)) ;; this node - (value tree (op (value truee)))) + (value tree (op (value tree)))) (else (if (symbol