Created
January 15, 2015 05:43
-
-
Save xuchunyang/4e644838b23636f19b93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(mapcar 'symbolp '(+ 1 "skin" nil t buffer-name)) | |
(t nil nil t t t) | |
;; | |
;; Symbol components | |
;; | |
;; 1. Print name | |
;; 2. Value | |
;; 3. Function | |
;; 4. Property list | |
(symbol-name 'symbol-name) | |
"symbol-name" | |
(symbol-function 'symbol-name) | |
#<subr symbol-name> | |
(defvar-local current-buffer-size (buffer-size)) | |
(symbol-value 'current-buffer-size) | |
333 | |
(symbol-value nil) | |
nil | |
(symbol-value t) | |
t | |
(symbol-plist 'current-buffer-size) | |
nil | |
;; | |
;; Define Symbols | |
;; | |
;; 1. use `defvar' and `defconst' to define variables | |
;; 2. use `defcustom' to define customizable variables | |
;; 3. use `defun' to define a symbol as a function | |
;; 4. use `defsubst' and `defalias' to define some special funcitons | |
;; 5 use `defmacro' to define a symbol as a macro | |
;; | |
;; Create Symbols (or the intern of Symbol | |
;; | |
(symbol-name 'foo) | |
"foo" | |
(setq sym (make-symbol "foo")) | |
foo | |
(eq sym 'foo) | |
nil | |
(setq sym (intern "foo")) | |
foo | |
(eq sym 'foo) | |
t | |
(intern "message") | |
message | |
;; | |
;; Symbol Properties | |
;; | |
(put 'fly 'verb 'transitive) | |
transitive | |
(symbol-plist 'fly) | |
(verb transitive noun (a buzzing little bug)) | |
(put 'fly 'noun '(a buzzing little bug)) | |
(a buzzing little bug) | |
(get 'fly 'verb) | |
transitive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment