您的位置:首页 > Web前端

Difference between SET, SETQ and SETF in LISP

2013-11-03 01:28 706 查看
SET can set the value of symbols;

SETQ can set the value of variables;

SETF is a macro that will call different function depending on what was called as its first argument.

examples

(set (quote l) '(1 2 3))
(1 2 3)

(set l '(1 2 3))
Failure, l must be a symbol.

(set 'l '(1 2 3))
(1 2 3)

(setq l '(1 2 3))
(1 2 3)

(setq (car l) 10)
Failure.

(setf l '(1 2 3))
(1 2 3)

(setf (car l) 10)

l is (10 2 3)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: