diff options
Diffstat (limited to 'src/types.lisp')
-rw-r--r-- | src/types.lisp | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/src/types.lisp b/src/types.lisp index 06183b1..c845b2d 100644 --- a/src/types.lisp +++ b/src/types.lisp @@ -31,11 +31,7 @@ (environment :reader closure-environment :initarg :environment :type list - :documentation "") - (specialp :reader closure-special-p - :initarg :specialp - :type boolean - :documentation "") + :documentation "Environment captured by the closure") (type :reader closure-type :initarg :type :type keyword @@ -45,9 +41,9 @@ :type function :documentation ""))) -(defun make-closure (function arg-list specialp groupp &optional environment type) +(defun make-closure (function arg-list groupp &optional environment type) (make-instance 'closure :function function :arg-list arg-list - :specialp specialp :groupp groupp + :groupp groupp :environment environment :type type)) @@ -88,3 +84,41 @@ (defun concat (&rest strings) (apply #'concatenate 'string strings)) + +(defclass object () + ((type :reader object-type + :initarg :type + :type keyword + :documentation "") + (value :reader object-value + :initarg :value + :type t + :documentation ""))) + +(defun make-object (type value) + (make-instance 'object :type type :value value)) + +(defun objectp (object) + (typep object 'object)) + +(defun object-symbol-p (object) + (and (objectp object) (eq (object-type object) :symbol))) + +(defmethod print-object ((object object) stream) + (format stream "#<OBJECT :TYPE ~A :VALUE ~A>" + (object-type object) (object-value object))) + +(defclass chain () + ((links :reader chain-links + :initarg :links + :type list + :documentation ""))) + +(defun make-chain (links) + (make-instance 'chain :links links)) + +(defun chainp (object) + (typep object 'chain)) + +(defmethod print-object ((object chain) stream) + (format stream "#<CHAIN :LINKS ~A>" (chain-links object))) |