X-Git-Url: https://jxself.org/git/?p=8sync.git;a=blobdiff_plain;f=doc%2F8sync-new-manual.org;h=3e17cbf4387f48504551630efb734b8dee3c89ef;hp=d0a99673891d0482bb522d00370574522f332bb9;hb=dc2155083a90de90e24f5341b837d4d96ce2898c;hpb=08fb307989f2696ddbd2ad535f55558c577b2fdb diff --git a/doc/8sync-new-manual.org b/doc/8sync-new-manual.org index d0a9967..3e17cbf 100644 --- a/doc/8sync-new-manual.org +++ b/doc/8sync-new-manual.org @@ -205,7 +205,7 @@ Change handle-line to this: #+BEGIN_SRC scheme (define-method (handle-line (irc-bot ) speaker channel line emote?) - (<- irc-bot (actor-id irc-bot) 'send-line channel + (<- (actor-id irc-bot) 'send-line channel (format #f "Bawwwwk! ~a says: ~a" speaker line))) #+END_SRC @@ -295,7 +295,7 @@ Luckily this is an easy adjustment to make. (or (equal? str my-name) (equal? str (string-concatenate (list my-name ":"))))) (when (looks-like-me?) - (<- irc-bot (actor-id irc-bot) 'send-line channel + (<- (actor-id irc-bot) 'send-line channel (format #f "Bawwwwk! ~a says: ~a" speaker line)))) #+END_SRC @@ -327,22 +327,22 @@ To implement it, we're going to pull out Guile's pattern matcher. (match action ;; The classic botsnack! ("botsnack" - (<- irc-bot (actor-id irc-bot) 'send-line channel + (<- (actor-id irc-bot) 'send-line channel "Yippie! *does a dance!*")) ;; Return greeting ((or "hello" "hello!" "hello." "greetings" "greetings." "greetings!" "hei" "hei." "hei!" "hi" "hi!") - (<- irc-bot (actor-id irc-bot) 'send-line channel + (<- (actor-id irc-bot) 'send-line channel (format #f "Oh hi ~a!" speaker))) ("echo" - (<- irc-bot (actor-id irc-bot) 'send-line channel + (<- (actor-id irc-bot) 'send-line channel (string-join action-args " "))) ;; ---> Add yours here <--- ;; Default (_ - (<- irc-bot (actor-id irc-bot) 'send-line channel + (<- (actor-id irc-bot) 'send-line channel "*stupid puppy look*")))))) #+END_SRC @@ -360,7 +360,7 @@ you're right: (or (equal? str my-name) (equal? str (string-concatenate (list my-name ":"))))) (define (respond respond-line) - (<- irc-bot (actor-id irc-bot) 'send-line channel + (<- (actor-id irc-bot) 'send-line channel respond-line)) (match (string-split line #\space) (((? looks-like-me? _) action action-args ...) @@ -503,7 +503,7 @@ things to: line emote?) ;; [... snip ...] (define (respond respond-line) - (<- irc-bot (actor-id irc-bot) 'send-line (pk 'channel channel) + (<- (actor-id irc-bot) 'send-line (pk 'channel channel) respond-line)) ;; [... snip ...] ) @@ -533,7 +533,7 @@ to looks like our own username that we respond back to the sender. line emote?) ;; [... snip ...] (define (respond respond-line) - (<- irc-bot (actor-id irc-bot) 'send-line + (<- (actor-id irc-bot) 'send-line (if (looks-like-me? channel) speaker ; PM session channel) ; normal IRC channel @@ -615,7 +615,7 @@ Time to get back to work! (define (manager-assign-task manager message difficulty) "Delegate a task to our direct report" (display "manager> Work on this task for me!\n") - (<- manager (manager-direct-report manager) + (<- (manager-direct-report manager) 'work-on-this difficulty)) #+END_SRC @@ -698,7 +698,7 @@ into a micromanager. (define (manager-assign-task manager message difficulty) "Delegate a task to our direct report" (display "manager> Work on this task for me!\n") - (<- manager (manager-direct-report manager) + (<- (manager-direct-report manager) 'work-on-this difficulty) ;; call the micromanagement loop @@ -710,7 +710,7 @@ into a micromanager. "Pester direct report until they're done with their task." (display "manager> Are you done yet???\n") (let ((still-working - (msg-val (<-wait manager (manager-direct-report manager) + (msg-val (<-wait (manager-direct-report manager) 'done-yet?)))) (if still-working (begin (display "manager> Harumph!\n") @@ -718,7 +718,7 @@ into a micromanager. (when (actor-alive? manager) (manager-micromanage-loop manager))) (begin (display "manager> Oh! I guess you can go home then.\n") - (<- manager (manager-direct-report manager) 'go-home))))) + (<- (manager-direct-report manager) 'go-home))))) #+END_SRC We've appended a micromanagement loop here... but what's going on? @@ -746,7 +746,7 @@ Of course, we need to update our worker accordingly as well. ;;; New procedures: (define (worker-done-yet? worker message) "Reply with whether or not we're done yet." - (<-reply worker message + (<-reply message (= (worker-task-left worker) 0))) (define (worker-go-home worker message)