Changeset 47 for trunk/example


Ignore:
Timestamp:
07/09/04 16:03:47 (21 years ago)
Author:
bmastenbrook
Message:

CLIM spec lookup

Location:
trunk/example
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/example/specbot.lisp

    r43 r47  
    3838
    3939(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)))
    4543
    4644(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)))
    5248
    5349(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)))
    5958
    6059(defvar *spec-providers*
    6160  '((clhs-lookup "clhs" "The Common Lisp HyperSpec")
    6261    (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")))
    6464
    6565(defvar *alists* nil)
     
    7474(defun simple-alist-lookup (designator string)
    7575  (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))))
    7977
    8078(defun valid-message (string prefix &key space-allowed)
     
    9088                       (format nil "~A:" address)
    9189                       (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)
    9391                (return-from strip-address (subseq string it))))
    9492  (and (not final) string))
     
    116114              do
    117115              (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))))))))
    119122 
    120123(defun start-specbot (nick server &rest channels)
Note: See TracChangeset for help on using the changeset viewer.