From: dskr@mac.com
Cc: guile-user@gnu.org
Subject: Re: Interpreter Sessions (Newbie)
Date: Sat, 22 Feb 2003 17:26:28 -0500 [thread overview]
Message-ID: <AFCD78D8-46B4-11D7-B786-00039394839E@mac.com> (raw)
In-Reply-To: <Pine.GSO.4.33.0302221353510.6987-100000@anakena>
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 <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 '())
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
prev parent reply other threads:[~2003-02-22 22:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-22 17:03 Interpreter Sessions (Newbie) Pedro Ortega
2003-02-22 17:53 ` Clinton Ebadi
2003-02-24 16:39 ` Paul Jarc
2003-02-24 21:50 ` Clinton Ebadi
2003-02-28 17:56 ` Paul Jarc
2003-02-28 19:54 ` Clinton Ebadi
2003-02-22 22:26 ` dskr [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AFCD78D8-46B4-11D7-B786-00039394839E@mac.com \
--to=dskr@mac.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).