home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sequent!ogicse!emory!swrinde!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!agate!stanford.edu!eos!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!bill@cambridge.apple.com
- From: bill@cambridge.apple.com (Bill St. Clair)
- Newsgroups: comp.lang.lisp.mcl
- Subject: Re: Making a lambda-expr more like a fn
- Message-ID: <9211161528.AA16443@cambridge.apple.com>
- Date: 16 Nov 92 16:33:40 GMT
- Article-I.D.: cambridg.9211161528.AA16443
- Sender: info-mcl-request@cambridge.apple.com
- Lines: 45
- Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
-
- At 23:03 11/15/92 -0800, Rik Belew wrote:
- >One of the changes to CL2 that bit me has been that
- >raw lambda's can no longer be funcall'd (or apply'd)
- >directly.
- >
- >With CMULisp, I have remedied this by coercing the lambda
- >into a function first:
- >
- > (setf (org-lexpr p) (coerce lexpr 'function))
- >
- >But CCL::COERCE-TO-FUNCTION won't have it:
- >
- >
- >> Error: value (LAMBDA (WLIST &AUX X1) (SETQ X1 (NTH 0 HISTORY)) (VALUES (+ (CAR WLIST) (* (NTH 1 WLIST) X1)) (LIST 1.0 X1))) is not of the expected type FUNCTION.
- >> While executing: CCL::COERCE-TO-FUNCTION
- >
- >I have also tried prepending the #' (function) abbrev., but
- >that result couldn't be funcalled either.
- >
- >I was able to get what I wanted compiling the form instead. However, in
- >this application, I would like very much to avoid the compilation overhead
- >if at all possible. Can I?
-
- At 11:28 11/16/92 +0000, Ranson wrote:
- >Only the evaluator and the compiler process #' to create a function. If you
- >don't want to compile, call EVAL.
- >Or better, try to not create functions at run time.
- > Daniel.
-
- Daniel is correct. COERCE will either call COMPILE or do preprocessing for
- EVAL depending on the value of *compile-definitions*. The problem with
- COERCE is a known compiler bug. Compiling the expression:
-
- (coerce x 'function)
-
- results in a call to ccl::coerce-to-function. It should result in a call to
- ccl::coerce-to-function-1. You can fix this in a number of ways:
-
- 1) Take Daniel's advice and don't try to create functions at run time.
-
- 2) Ask me to send you "coerce-to-function-patch"
- This patch will be part of patch 2 for MCL 2.0.
-
- 3) write (funcall 'coerce x 'function) instead of (coerce x 'function)
- This will be slightly slower than option 2, but I doubt you'll notice.
-