clos

    1热度

    2回答

    我有两个包中都定义了一个类。第二个类继承了第一个类,但有一个同名的插槽。其目的确实是为了覆盖插槽。 (defpackage :foo (:use :cl) (:export foo)) (in-package :foo) (defclass foo() ((s))) (defpackage :bar (:use :cl :foo) (:expor

    2热度

    2回答

    我有一个类消息的实例,我将称之为“味精”。我定义了一个类“my-message”,并希望实例“msg”现在成为该类。 这听起来像它应该是相对简单的,但我不知道该怎么做。改变班给了我一个我不明白的错误。 (defclass my-message (message) ((account-name :accessor account-name :initform nil :initarg :a

    2热度

    1回答

    保存任何Common Lisp的结构对象到一个文件(可读)似乎与像 (defun save-structure-object (object filename) (with-open-file (stream filename :direction :output :if-exists :supersede) (with-standard-io-syn

    0热度

    1回答

    Saving CLOS objects中的sds的注释提供了对Common Lisp开放代码集合(CLOCC)文件(closio.lisp)的引用,用于可读地读取编写CLOS对象的&。有关安装该软件的说明,请参阅Installation of CLOCC。但是,以前没有使用过CLOCC,我希望为设置读/写CLOS对象设置一些额外的指导。以下是到目前为止我的init文件(.clinit)的附加内容:

    1热度

    1回答

    我收到以下错误试图编译一些代码时: Lambda list of method # is incompatible with that of the generic function INITIALIZE-INSTANCE. Method's lambda-list : (PAT::E) Generic-function's : (CCL::INSTANCE &REST CCL::INITARGS

    2热度

    2回答

    我正在学习CLOS中的泛型函数。 由于我在教科书和在线中找到的例子类型,我感到非常困惑。这些例子总是使用有多个派遣的事实。根据参数类型,执行不同的计算。但是,为什么这些论据本身从未在例子中被使用? 实施例的代码从Wikipedia ; declare the common argument structure prototype (defgeneric f (x y)) ; define a

    0热度

    2回答

    Greg Pfeil的Class Hierarchy图提供了Common Lisp类型系统的全面图片。但我试图更好地理解层次结构顶部的阶级关系。举一个简单的例子,让(defstruct person name age),然后(defparameter *p1* (make-person :name "Yosh" :age 19)。现在 (typep *p1* 'person) T (typep

    0热度

    2回答

    假设我们有两个软件包,每个软件包定义一个类并为相同名称导出插槽/通用方法的符号。 (defpackage pkg1 (:export _class1 _slot _reader _method)) (in-package pkg1) (defclass _class1() ((_slot :initform "SLOT111" :initarg :slot :reader _reader)))

    2热度

    1回答

    有没有办法从Common Lisp的通用函数中提取方法列表? 例如: (defmethod say ((self string)) ; method-0 (format t "Got string: ~a~%" self)) (defmethod say ((self integer)) ; method-1 (format t "Got integer: ~a~%" se

    0热度

    1回答

    考虑类account: (defclass account() ((name :initarg :name :reader name) (balance :initarg :balance :initform 0.00 :accessor balance) (interest-rate :allocation :class :initform 0.06