Changeset 47 for trunk/example
- Timestamp:
- 07/09/04 16:03:47 (21 years ago)
- Location:
- trunk/example
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/example/specbot.lisp ¶
r43 r47 38 38 39 39 (defun clhs-lookup (str) 40 (aif (and (find-package :clhs-lookup) 41 (funcall (intern "SPEC-LOOKUP" :clhs-lookup) 42 str)) 43 it 44 (format nil "Nothing was found for: ~A" str))) 40 (and (find-package :clhs-lookup) 41 (funcall (intern "SPEC-LOOKUP" :clhs-lookup) 42 str))) 45 43 46 44 (defun r5rs-lookup (str) 47 (aif (and (find-package :r5rs-lookup) 48 (funcall (intern "SYMBOL-LOOKUP" :r5rs-lookup) 49 str)) 50 it 51 (format nil "Nothing was found for: ~A" str))) 45 (and (find-package :r5rs-lookup) 46 (funcall (intern "SYMBOL-LOOKUP" :r5rs-lookup) 47 str))) 52 48 53 49 (defun elisp-lookup (str) 54 (aif (and (find-package :elisp-lookup) 55 (funcall (intern "SYMBOL-LOOKUP" :elisp-lookup) 56 str)) 57 it 58 (format nil "Nothing was found for: ~A" str))) 50 (and (find-package :elisp-lookup) 51 (funcall (intern "SYMBOL-LOOKUP" :elisp-lookup) 52 str))) 53 54 (defun clim-lookup (str) 55 (and (find-package :clim-lookup) 56 (funcall (intern "TERM-LOOKUP" :clim-lookup) 57 str))) 59 58 60 59 (defvar *spec-providers* 61 60 '((clhs-lookup "clhs" "The Common Lisp HyperSpec") 62 61 (r5rs-lookup "r5rs" "The Revised 5th Ed. Report on the Algorithmic Language Scheme") 63 (elisp-lookup "elisp" "GNU Emacs Lisp Reference Manual"))) 62 (elisp-lookup "elisp" "GNU Emacs Lisp Reference Manual") 63 (clim-lookup "clim" "Common Lisp Interface Manager II Specification"))) 64 64 65 65 (defvar *alists* nil) … … 74 74 (defun simple-alist-lookup (designator string) 75 75 (let ((alist (cdr (assoc designator *alists*)))) 76 (aif (assoc string alist :test #'equalp) 77 (cdr it) 78 (format nil "Nothing was found for: ~A" string)))) 76 (cdr (assoc string alist :test #'equalp)))) 79 77 80 78 (defun valid-message (string prefix &key space-allowed) … … 90 88 (format nil "~A:" address) 91 89 (format nil "~A, " address)) 92 do (aif (valid-message string i :space-allowed (not final))90 do (aif (valid-message string i :space-allowed t) 93 91 (return-from strip-address (subseq string it)))) 94 92 (and (not final) string)) … … 116 114 do 117 115 (aif (strip-address to-lookup :address (second type) :final t) 118 (privmsg *connection* destination (funcall actual-fun it))))))) 116 (let ((looked-up (funcall actual-fun it))) 117 (if (and (< 0 (count #\space it) 3) 118 (not looked-up)) 119 (setf looked-up (format nil "Sorry, I couldn't find anything for ~A." it))) 120 (and looked-up 121 (privmsg *connection* destination looked-up)))))))) 119 122 120 123 (defun start-specbot (nick server &rest channels)
Note: See TracChangeset
for help on using the changeset viewer.