From 5b518ad7205b3432d95ff2b3757e49914233d913 Mon Sep 17 00:00:00 2001 From: Thomas Albers Raviola Date: Sun, 5 Jan 2025 16:55:51 +0100 Subject: Clean up eval-tree --- src/types.lisp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src/types.lisp') diff --git a/src/types.lisp b/src/types.lisp index c845b2d..4b24219 100644 --- a/src/types.lisp +++ b/src/types.lisp @@ -19,6 +19,9 @@ (defmethod content ((object (eql 'empty-line))) (list (make-text ""))) +(defmethod print-object ((object text) stream) + (format stream "#" (content object))) + (defclass closure () ((function :reader closure-function :initarg :function @@ -50,21 +53,6 @@ (defun closurep (object) (typep object 'closure)) -(defun group (item sequence &key (test #'eql)) - (group-if #'(lambda (x) (funcall test item x)) sequence)) - -(defun group-if (predicate sequence) - (loop :for (head . tail) :on sequence - :while (funcall predicate head) - :collect head :into group - :finally - (return (values group (if (not (funcall predicate head)) - (cons head tail) - tail))))) - -(defun group-if-not (predicate sequence) - (group-if (complement predicate) sequence)) - (defun whitespacep (char-or-string) (if (stringp char-or-string) (every #'whitespacep char-or-string) @@ -104,6 +92,9 @@ (defun object-symbol-p (object) (and (objectp object) (eq (object-type object) :symbol))) +(deftype object-symbol () + `(satisfies object-symbol-p)) + (defmethod print-object ((object object) stream) (format stream "#" (object-type object) (object-value object))) -- cgit v1.2.3