Code: Select all
(setq a '(1 2 3)) ;; This list can not be evaled
(setq b '(1 a)) ;; This list can be evaled, (eval b) --> (2 3)
(setq c '(+ 1 2)) ;; This list can be evaled, (eval c) --> 3
Is there an universal method to determine whether a list can be evaluated or not?
In the following example:
Code: Select all
(setq a '(1 2 3))
(setq d '((1 a) (3 4)))
(define (f lst) (+ (last lst) 1))
(f (d 0)) ;;->ERR: value expected : a
;; called from user function (f (d 0))
(f a) ;;-> 4
But "eval" can not used like this: (f (eval a)).
As the structure of the argument "lst" can not be forseen, is there a way to determine whether a list can be evaluated or not?