Steve Gonedes <sgonedes@mixcom.com> wrote:
+---------------
| ...some clarification would be really great. These all result in error:
|
| (progv '(a b c) '(list 1 2)
| (eval (a b c)))
+---------------
Try it this way:
> (progv '(a b c) `(,#'list 1 2) ; or (list (function list) 1 2)
(funcall a b c))
==> (1 2)
>
+---------------
| (progv '(a b c) '(values 1 2)
| (funcall a b c))
+---------------
Weird. This one works fine for me. CLtL2 says that "funcall" can take
either a symbol [as in this case] or a function, so it should work for
you, too:
> (progv '(a b c) '(values 1 2)
(funcall a b c))
==> 1
==> 2
>
Could your Lisp be having trouble with "values" in a "progv" (or a "funcall)?
Try it this way [with variable "a" containing a function value instead of a
symbol], and see what happens:
> (progv '(a b c) `(,#'values 1 2)
(funcall a b c))
==> 1
==> 2
>
+---------------
| (progv '(a b c) '(+ 1 2)
| (eval '(a b c)))
+---------------
This one fails for the same reason your very first one did -- "a" doesn't
have a function value, only a variable value (the symbol "+"). Compare:
> (defun a (x y) (* x y)) ; or (setf (symbol-function 'a) #'*)
==> A ; ==> #<SYSTEM-FUNCTION *>
> (progv '(a b c) '(+ 3 4)
(a b c))
==> 12
> (progv '(a b c) '(+ 3 4)
(eval '(a b c))) ; eval still gets the fcn, not symb
==> 12
> (progv '(a b c) `(,#'+ 3 4) ; or (list (function +) 3 4)
(funcall a b c))
==> 7
>
-Rob
-----
Rob Warnock, 7L-551 rpw3@sgi.com http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673 [New area code!]
2011 N. Shoreline Blvd. FAX: 650-933-4392
Mountain View, CA 94043 PP-ASEL-IA