diff options
author | Thomas Albers Raviola <thomas@thomaslabs.org> | 2025-01-05 16:55:51 +0100 |
---|---|---|
committer | Thomas Albers Raviola <thomas@thomaslabs.org> | 2025-01-05 17:11:20 +0100 |
commit | 5b518ad7205b3432d95ff2b3757e49914233d913 (patch) | |
tree | c4abb63c32cc1821a1f072a9e6487d067a873bc3 /src/types.lisp | |
parent | bc69faaa5bbd8a2d8afb9ab81882b1ba21c4bb8e (diff) |
Clean up eval-tree
Diffstat (limited to 'src/types.lisp')
-rw-r--r-- | src/types.lisp | 21 |
1 files changed, 6 insertions, 15 deletions
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 "#<TEXT \"~A\">" (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 ~A :VALUE ~A>" (object-type object) (object-value object))) |