tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
12
Task/Polymorphic-copy/Common-Lisp/polymorphic-copy-1.lisp
Normal file
12
Task/Polymorphic-copy/Common-Lisp/polymorphic-copy-1.lisp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(defstruct super foo)
|
||||
|
||||
(defstruct (sub (:include super)) bar)
|
||||
|
||||
(defgeneric frob (thing))
|
||||
|
||||
(defmethod frob ((super super))
|
||||
(format t "~&Super has foo = ~w." (super-foo super)))
|
||||
|
||||
(defmethod frob ((sub sub))
|
||||
(format t "~&Sub has foo = ~w, bar = ~w."
|
||||
(sub-foo sub) (sub-bar sub)))
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(defmethod frob ((sequence sequence))
|
||||
(format t "~&sequence has ~w elements" (length sequence)))
|
||||
|
||||
(defmethod frob ((string string))
|
||||
(format t "~&the string has ~w elements" (length string)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue