So I have classes
(defclass foo ()
((a :initarg :a :accessor a)
(b :initarg :b :accessor b)))
(defclass bar (foo)
((c :initarg :c)))
And a constructor
(defun make-foo (a b)
(make-instance 'foo :a a :b b))
Is there a simple way to define a function that takes in an existing FOO
and produces a BAR
with the extra slot C
defined? I.e. without having to list out all the slots as such:
(defun make-bar-from-foo (existing-foo c)
(make-instance 'bar :a (a existing-foo) :b (b existing-foo) :c c))