(require :asdf)
(require :alexandria)

(in-package :CL-USER)

(defmacro capture-read (&body body)
  `(with-input-from-string
       (*standard-input*
	(with-output-to-string (*standard-output*)
	  ,@body))
     (read)))

(defgeneric (setf form) (o v))

(defclass eve () (form))

(defmethod parthenogenesis
    ((obj eve) &aux (class (class-name (class-of obj))))
  (eval
   `(defmethod parthenogenesis :around
      ((obj ,class))
     (capture-read
      (format t "
(let
    ((form
      '~s))
 (let ((particular-quine (eval form)))
  (setf (form particular-quine) form)
  (values particular-quine)))
"
	    (form obj)))))
  (parthenogenesis obj))

(defun form-eve ()
  (let
      ((form
	 '(macrolet
	   ((ana-quine-class
	     ((&rest class-paraphernalia) &body body)
	     (alexandria:with-gensyms (classname)
	       `(let ((quine
			(defclass ,classname
			    ,@class-paraphernalia)))
		  ,@body))))
	   (ana-quine-class
	    ((eve) ((form :accessor form))
	     (:documentation " . . . "))
	    (values (make-instance quine))))))
    (let ((particular-quine (eval form)))
      (setf (form particular-quine) form)
      (values particular-quine))))