[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interpreter Sessions (Newbie)

From: dskr
Subject: Re: Interpreter Sessions (Newbie)
Date: Sat, 22 Feb 2003 17:26:28 -0500


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)

(define module-get-matching-symbol-list (lambda (m r)
"accept a module <m> and regexp <r> and return a list of symbols which match"
  (define cr (make-regexp r))
  (define little-helper (lambda (l acc)
    (if (eq? l '())
      (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 '())
      (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)) '())

        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

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]