2009-05-22 14 views

答えて

17

機能追加・ツー・リスト(4 1 2 3)

章Fから

に等しいaもたらす

(setq a '(1 2 3)) 
(add-to-list 'a 4) 
(add-to-list 'a 3) 

を添加する前に自動的にチェックする追加ツーリスト:

 
add-to-list is a compiled Lisp function in `subr.el'. 
(add-to-list list-var element &optional append compare-fn) 

Add element to the value of list-var if it isn't there yet. 
The test for presence of element is done with `equal', 
or with compare-fn if that's non-nil. 
If element is added, it is added at the beginning of the list, 
unless the optional argument append is non-nil, in which case 
element is added at the end. 

The return value is the new value of list-var. 

If you want to use `add-to-list' on a variable that is not defined 
until a certain package is loaded, you should put the call to `add-to-list' 
into a hook function that will be run only after loading the package. 
`eval-after-load' provides one way to do this. In some cases 
other hooks, such as major mode hooks, can do the job. 

+3

これは素晴らしいです!ありがとう! –

関連する問題