Update of /project/cl-irc/cvsroot/cl-irc/example In directory common-lisp.net:/home/bmastenbrook/cl-irc/example
Modified Files: advice cliki.lisp specbot.lisp Log Message: um, not sure
Date: Thu Aug 5 09:54:09 2004 Author: bmastenbrook
Index: cl-irc/example/advice diff -u cl-irc/example/advice:1.1 cl-irc/example/advice:1.2 --- cl-irc/example/advice:1.1 Tue Jul 27 13:39:42 2004 +++ cl-irc/example/advice Thu Aug 5 09:54:09 2004 @@ -95,4 +95,5 @@ (11963 . "It's easy to get the *wrong* answer in O(1) time.") (11964 . "I guess this just goes to show that you can lead a horse to water, but you can't make him drink it.") - (11999 . "You are a stupid asshole. Shut the fuck up.")) \ No newline at end of file + (11999 . "You are a stupid asshole. Shut the fuck up.") + (12000 . "Looking for a compiler bug is the second-to-last resort. The last resort is blaming bad RAM. It's never the correct hypothesis."))
Index: cl-irc/example/cliki.lisp diff -u cl-irc/example/cliki.lisp:1.21 cl-irc/example/cliki.lisp:1.22 --- cl-irc/example/cliki.lisp:1.21 Wed Jul 28 08:45:42 2004 +++ cl-irc/example/cliki.lisp Thu Aug 5 09:54:09 2004 @@ -1,4 +1,4 @@ -;;;; $Id: cliki.lisp,v 1.21 2004/07/28 15:45:42 bmastenbrook Exp $ +;;;; $Id: cliki.lisp,v 1.22 2004/08/05 16:54:09 bmastenbrook Exp $ ;;;; $Source: /project/cl-irc/cvsroot/cl-irc/example/cliki.lisp,v $
;;;; cliki.lisp - CLiki as an infobot; only works on SBCL. @@ -487,42 +487,7 @@ channel)) (return-from cliki-lookup nil)) (or - (let ((strings - (or - (aif - (nth-value 1 (scan-to-strings "^(?i)(direct|tell|show|inform|teach|give)\s+(\S+)\s+(about|on|in|to|through|for|some|)\s*(.+)$" first-pass)) - (cons :forward it)) - (aif - (nth-value 1 (scan-to-strings "^(?i)(look\s+up\s+|)\s*(.+)\s+(for|to|at)\s+(\S+)$" first-pass)) - (cons :backward it)) - ))) - (if strings - (let* ((term (case (car strings) - (:forward (elt (cdr strings) 3)) - (:backward (elt (cdr strings) 1)))) - (person (case (car strings) - (:forward (elt (cdr strings) 1)) - (:backward (elt (cdr strings) 3)))) - (person (if (string-equal person "me") - (or sender channel "you") - person)) - (about (cliki-lookup term :sender sender - :channel channel))) - (if about - (format nil "~A: ~A~A" - person - (if (scan "http:" about) - (concatenate 'string - (random-element - '("have a look at" - "please look at" - "please see" - "direct your attention towards" - "look at")) - " ") - "") - about) - (setf should-send-cant-find nil))))) + (if (string-equal first-pass "help") (if (should-do-lookup first-pass (or channel sender "")) (progn @@ -575,7 +540,42 @@ (let ((strs (nth-value 1 (scan-to-strings "^(?i)paste\s+(\d+)$" first-pass)))) (and strs (lookup-paste (parse-integer (elt strs 0))))) - + (let ((strings + (or + (aif + (nth-value 1 (scan-to-strings "^(?i)(direct|tell|show|inform|teach|give)\s+(\S+)\s+(about|on|in|to|through|for|some|)\s*(.+)$" first-pass)) + (cons :forward it)) + (aif + (nth-value 1 (scan-to-strings "^(?i)(look\s+up\s+|)\s*(.+)\s+(for|to|at)\s+(\S+)$" first-pass)) + (cons :backward it)) + ))) + (if strings + (let* ((term (case (car strings) + (:forward (elt (cdr strings) 3)) + (:backward (elt (cdr strings) 1)))) + (person (case (car strings) + (:forward (elt (cdr strings) 1)) + (:backward (elt (cdr strings) 3)))) + (person (if (string-equal person "me") + (or sender channel "you") + person)) + (about (cliki-lookup term :sender sender + :channel channel))) + (if about + (format nil "~A: ~A~A" + person + (if (scan "http:" about) + (concatenate 'string + (random-element + '("have a look at" + "please look at" + "please see" + "direct your attention towards" + "look at")) + " ") + "") + about) + (setf should-send-cant-find nil))))) (if (scan "^(?i)hello(\s|$)*" first-pass) "what's up?") (if (scan "^(?i)hi(\s|$)*" first-pass) "what's up?") (if (scan "^(?i)yo(\s|$)*" first-pass) "what's up?")
Index: cl-irc/example/specbot.lisp diff -u cl-irc/example/specbot.lisp:1.6 cl-irc/example/specbot.lisp:1.7 --- cl-irc/example/specbot.lisp:1.6 Tue Jul 27 11:47:00 2004 +++ cl-irc/example/specbot.lisp Thu Aug 5 09:54:09 2004 @@ -1,4 +1,4 @@ -;;;; $Id: specbot.lisp,v 1.6 2004/07/27 18:47:00 bmastenbrook Exp $ +;;;; $Id: specbot.lisp,v 1.7 2004/08/05 16:54:09 bmastenbrook Exp $ ;;;; $Source: /project/cl-irc/cvsroot/cl-irc/example/specbot.lisp,v $
;;;; specbot.lisp - an example IRC bot for cl-irc @@ -129,8 +129,17 @@ (or *load-truename* *default-pathname-defaults*)))))
+(defparameter *ppc-file* + (merge-pathnames "ppc-assem.lisp-expr" + (make-pathname + :directory + (pathname-directory + (or *load-truename* + *default-pathname-defaults*))))) + (defun start-specbot (nick server &rest channels) (add-simple-alist-lookup *754-file* 'ieee754 "ieee754" "Section numbers of IEEE 754") + (add-simple-alist-lookup *ppc-file* 'ppc "ppc" "PowerPC assembly mnemonics") (setf *nickname* nick) (setf *connection* (connect :nickname *nickname* :server server)) (mapcar #'(lambda (channel) (join *connection* channel)) channels)