home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!wupost!cs.utexas.edu!asuvax!farallon!danny.farallon.com!user
- From: danny@farallon.com (Danny Brewer)
- Newsgroups: comp.lang.lisp
- Subject: Can I use EVAL?
- Message-ID: <danny-250892143222@danny.farallon.com>
- Date: 25 Aug 92 19:52:35 GMT
- Sender: news@farallon.farallon.com
- Followup-To: comp.lang.lisp
- Organization: Farallon Computing, Inc.
- Lines: 32
- Nntp-Posting-Host: danny
-
- I have a compiling matcher I've written that takes a pattern and
- returns a LAMBDA expression which performs the actual match.
- Here is an example: (MCL2 prompts with a "?")
-
- ;;; Match a pattern and datum using the interpretive matcher
-
- ? (Match '(a ?x c) '(a b c))
- ((?X . B))
-
- ;;; It matches with one variable binding.
- ;;; Now compile the pattern into a LAMBDA using compiling matcher
-
- ? (Compile-Match '(a ?x c))
- (LAMBDA (DATUM ...) [...a bunch of code deleted...] )
-
- ? (SETF *p* *) ; save pattern code in a variable
- ? (SETF *d* '(a b c)) ; set datum variable
-
- Now that I've got the LAMBDA in the variable *p*, how can I do
- anything with it? I can't FUNCALL or APPLY it. But I can
- use a really ugly EVAL as follows:
-
- ? (EVAL `(,*p* ',*d*))
- ((?X . B))
-
- This works okay, but yucko!
-
- Anybody got any better ideas?
- Thanks.
-
- Danny Brewer
- danny@farallon.com
-