home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!Sirius.dfn.de!chx400!sicsun!disuns2!disuns2.epfl.ch!simon
- From: simon@lia.di.epfl.ch (Simon Leinen)
- Newsgroups: comp.lang.lisp
- Subject: Re: Can I use EVAL?
- Message-ID: <SIMON.92Aug27095229@liasg1.epfl.ch>
- Date: 27 Aug 92 07:52:29 GMT
- References: <danny-250892143222@danny.farallon.com>
- Sender: news@disuns2.epfl.ch
- Followup-To: comp.lang.lisp
- Organization: DI-LIA -- Ecole Polytechnique Federale de Lausanne
- Lines: 27
- Nntp-Posting-Host: liasg1.epfl.ch
- In-reply-to: danny@farallon.com's message of 25 Aug 92 19:52:35 GMT
- X-Md4-Signature: c000bb6de9cf55af90e8b58c6acb8db9
-
- In article <danny-250892143222@danny.farallon.com> danny@farallon.com
- (Danny Brewer) writes:
-
- ? (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.
-
- You can funcall the lambda expression by coercing it to FUNCTION first
- (this is only necessary in ANSIfied Common Lisps):
-
- (funcall (coerce *p* 'function) *d*)
-
- ...but this is really very equivalent to using EVAL.
- Or you can force compilation of the code using COMPILE:
-
- (funcall (compile nil *p*) *d*)
-
- In this case you would probably save the result of the COMPILE
- somewhere because compilation makes most sense when you reuse the
- compiled matcher for many operations.
- --
- Simon.
-