From: gantar
Subject: Passing an environment to an EVAL-like function
Date: 
Message-ID: <c6s2pu$fiuo6$1@ID-233101.news.uni-berlin.de>
Dear cll,

I want to pass a form to a function for evaluation.
EVAL does can't access local variables. Is there an
EVAL that works with ENV (I once saw that Scheme's
EVAL accepts an ENV-parameter)?

Perhaps I'm totally off track anyway. What I want
to do is build a state-machine that performs
some predefined operation upon a given input.
For that I store the possible inputs and what to
do with it (a form) in a table. Isn't this
pretty lispish?

The simplest way to go is to ditch the local
variables, but I'm scared off of name-clashes
and the mess variables in the global namespace
make.

Kind regards, tip of the propeller-hat
Gantar
From: Matthew Danish
Subject: Re: Passing an environment to an EVAL-like function
Date: 
Message-ID: <20040429233312.GV25328@mapcar.org>
On Fri, Apr 30, 2004 at 01:20:13AM +0200, gantar wrote:
> Perhaps I'm totally off track anyway. What I want
> to do is build a state-machine that performs
> some predefined operation upon a given input.
> For that I store the possible inputs and what to
> do with it (a form) in a table. Isn't this
> pretty lispish?

What you really want to store is a closure.  For example:

(defparameter *input-table*
  `((A . ,#'(lambda (...) ...stuff-to-do...))
    ...))

or (add-to-table 'A #'(lambda ...)) however you build up your table.

-- 
; Matthew Danish <·······@andrew.cmu.edu>
; OpenPGP public key: C24B6010 on keyring.debian.org
; Signed or encrypted mail welcome.
; "There is no dark side of the moon really; matter of fact, it's all dark."