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)
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)
相关文章推荐
- Difference between List and Set in Java Collection
- differences between List and Set interface in point format
- Difference between RegularEnumSet and JumboEnumSet in Java
- Difference between List and Set in Java Collection
- Difference between LET and LET* in Common LISP
- whats is the difference between train, validation and test set, in neural networks?
- Difference between HashSet and HashMap in Java
- Difference between List and Set in Java Collection
- Difference between Set, List and Map in Java - Interview question
- Whats is the difference between train, validation and test set, in neural networks?
- Difference between TreeMap and TreeSet in Java
- Java - Difference between HashMap and HashSet in Java
- Difference between save vs persist and saveOrUpdate in Hibernate
- Difference between Override and Reintroduce in Delphi
- 【iOS】Difference Between objectForKey and valueForKey in NSDictionary
- [WPF]The differences between Text Box and Text Block in Blend
- Difference between Scopes and Namespaces in python
- Difference between Comparator and Comparable in java
- What are the differences between a pointer variable and a reference variable in C++?
- Difference between HashMap, LinkedHashMap and TreeMap in Java