使用setq

来源:互联网 发布:网络维护培训 编辑:程序博客网 时间:2024/06/03 16:22
使用setq(setq carnivores '(lion tiger leopard))上面一行与(set 'carnivores '(lion tiger leopard))完全相同。setq还可以设置多个变量:
     (setq trees '(pine fir oak maple)           herbivores '(gazelle antelope zebra))

计数
     (setq counter 0)                ; Let's call this the initializer.
     
     (setq counter (+ counter 1))    ; This is the incrementer.
     
     counter                         ; This is the counter.
每执行一次第二行,都会加1.