aboutsummaryrefslogtreecommitdiff
path: root/src/types.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/types.lisp')
-rw-r--r--src/types.lisp21
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)))