-
Notifications
You must be signed in to change notification settings - Fork 0
/
animal.lisp
executable file
·53 lines (45 loc) · 973 Bytes
/
animal.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
;#!/usr/local/bin/sbcl --script
;;;; Hey, Emacs, this is a -*- Mode: Lisp; Syntax: Common-Lisp -*- file!
;;;;
;;;; Lisp...not just beautiful, but strangely beautiful.
;;;; -- Paul Graham
;;;;
;;;; Name: animal.lisp
;;;;
;;;; Started: Sat Oct 15 03:53:25 2011
;;;; Modifications:
;;;;
;;;; Purpose:
;;;;
;;;;
;;;;
;;;; Calling Sequence:
;;;;
;;;;
;;;; Inputs:
;;;;
;;;; Outputs:
;;;;
;;;; Example:
;;;;
;;;; Notes:
;;;;
;;;;
(load "/Users/dsletten/lisp/packages/test.lisp")
(defpackage :animal (:use :common-lisp :test))
(in-package :animal)
(defclass animal () ())
(defgeneric behave (animal))
(defmethod behave ((a animal))
(write-line "Urp!"))
(defclass dog (animal) ())
(defmethod behave ((d dog))
(wag-tail d)
(bark d))
(defgeneric wag-tail (dog))
(defgeneric bark (dog))
(defmethod wag-tail ((d dog))
(write-line "Wag!"))
(defmethod bark ((d dog))
(write-line "Woof!"))
(defclass mulgara (animal) ())