From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: dskr@mac.com Newsgroups: gmane.lisp.guile.user Subject: Re: Interpreter Sessions (Newbie) Date: Sat, 22 Feb 2003 17:26:28 -0500 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v548) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1045952816 24544 80.91.224.249 (22 Feb 2003 22:26:56 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 22 Feb 2003 22:26:56 +0000 (UTC) Cc: guile-user@gnu.org Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18mi6f-0006Na-00 for ; Sat, 22 Feb 2003 23:26:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18mi6j-0001Ny-05 for guile-user@m.gmane.org; Sat, 22 Feb 2003 17:26:57 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18mi6H-0001CV-00 for guile-user@gnu.org; Sat, 22 Feb 2003 17:26:29 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18mi64-0000vs-00 for guile-user@gnu.org; Sat, 22 Feb 2003 17:26:18 -0500 Original-Received: from smtpout.mac.com ([17.250.248.97]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18mi5v-0000ho-00 for guile-user@gnu.org; Sat, 22 Feb 2003 17:26:07 -0500 Original-Received: from asmtp01.mac.com (asmtp01-qfe3 [10.13.10.65]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id h1MMQ1F4014798 for ; Sat, 22 Feb 2003 14:26:01 -0800 (PST) Original-Received: from mac.com ([64.157.55.234]) by asmtp01.mac.com (Netscape Messaging Server 4.15) with ESMTP id HAQEBB00.6BI; Sat, 22 Feb 2003 14:25:59 -0800 Original-To: Pedro Ortega In-Reply-To: X-Mailer: Apple Mail (2.548) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: General Guile related discussions List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:1685 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:1685 Pedro, I do a similar thing. The easy part -- seperate domains for each user: (define interpreter-module (make-module)) (define result (eval (+ 1 2 3) interpreter-module)) The hard part -- storing and loading that environment. Guile will let you get the symbols defined in a module (which you could then save) example: (define module-get-matching-symbol-list (lambda (m r) "accept a module and regexp and return a list of symbols which match" (define cr (make-regexp r)) (define little-helper (lambda (l acc) (if (eq? l '()) acc (if (regexp-exec cr (object->string (car (car l)))) ; the symbol name matched (little-helper (cdr l) (cons (car l) acc)) ; the symbol name didn't match (little-helper (cdr l) acc) ) ) )) (define mgms-helper (lambda (l acc) (if (eq? l '()) acc (if (eq? (car l) '()) (mgms-helper (cdr l) acc) (mgms-helper (cdr l) (little-helper (car l) acc)) ) ) )) (mgms-helper (array->list (module-obarray m)) '()) )) Regards, Dan Ridge On Saturday, Feb 22, 2003, at 12:03 US/Eastern, Pedro Ortega wrote: > This has problably been asked before many times. Sorry, > but I didn't find anything in the Guile user manual about > this. > > I'm currently programming a Chatbot, wich does execute > Scheme code to produce the answer, triggered by an input > string (something like A.L.I.C.E.). The Chatbot is server > based, so what I need is: > > 1. Given an user id, create (if it doesn't exist) or > restore the environment (using a database or another > persistent storage media). > > 2. Execute the Scheme code with the environment, in order > to get the response string. > > 3. Respond to the user. > > 4. Save the updated environment. > > This hasn't to be accomplished in parallel, querys can be > put in a queue and be responded serially. > > Thanks for your help. > > Pedro Ortega > IA Department, > University of Chile > > > > > _______________________________________________ > Guile-user mailing list > Guile-user@gnu.org > http://mail.gnu.org/mailman/listinfo/guile-user > _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user