how to prevent unwanted eval?
Posted: Sun Aug 30, 2020 12:35 am
I use a function "f" to store data by calling another function "g" like this:
By contrast,
Is there a better way to prevent this kind of unwanted eval during the parameter transfer?
Code: Select all
(define (g (x y)) x)
(define (f data)
(setf (nth '(0 0 1) g) data)
)
;;test:
(f 1)
(g) ;; -> 1 Right. This is what I want.
(g) ;; -> 1 Right. This is what I want.
(f '(+ 1 2))
(g) ;; -> 3 This is not what I want. I can't understand why the quoted list '(+ 1 2) is evaluated?. I just want to get the list itself '(+ 1 2)
Code: Select all
(define (g x) x)
(define (f data) (g data))
(f '(+ 1 2)) ;; -> (+ 1 2) The list is not evaled.