hello, i am trying to learn about clos.
i made a defclass like this:
(defclass person ()
((name :accessor name
:initarg name)))
now i just want to make-instance an instance with a name.
nothing i try seems to work. please help.
david <····@spam.net> writes:
> hello, i am trying to learn about clos.
> i made a defclass like this:
>
> (defclass person ()
> ((name :accessor name
> :initarg name)))
>
> now i just want to make-instance an instance with a name.
> nothing i try seems to work. please help.
The symbol you used as the :initarg should precede the initialization
argument in make-instance:
(make-instance 'person 'name "david")
It's pretty common to use keyword symbols as initargs:
(defclass person ()
((name :accessor name
:initarg :name)))
Then the make-instance would be:
(make-instance 'person :name "david")
Zach
Zach Beane wrote:
>
> The symbol you used as the :initarg should precede the initialization
> argument in make-instance:
>
> (make-instance 'person 'name "david")
>
> It's pretty common to use keyword symbols as initargs:
>
> (defclass person ()
> ((name :accessor name
> :initarg :name)))
>
> Then the make-instance would be:
>
> (make-instance 'person :name "david")
>
> Zach
problem solved, thank you very much :)