1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# cat /root/elisp/function.el
(defun variable_arity (a &optional b &rest c)
"This is a function which has variable arity"
(message (concat
"variable a is "
a))
(message (concat
"variable b is "
b))
(
if
c (message
"c is not an empty list"
)
(message
"c is an empty list"
)))
(message
"run the fn with 1 variable"
)
(variable_arity
"eh"
)
(message
"run the fn with 2 variables"
)
(variable_arity
"eh"
"bee"
)
(message
"run the fn with 3 variables"
)
(variable_arity
"eh"
"bee"
"see"
)
(message
"run the fn with 4 variables"
)
(variable_arity
"eh"
"bee"
"see"
"dee"
)
(message
"run the fn with 5 variables"
)
(variable_arity
"eh"
"bee"
"see"
"dee"
"eee"
)
|
如何在命令行执行:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# emacs --no-site-file --script /root/elisp/function.el
run the fn with 1 variable
variable a is eh
variable b is
c is an empty list
run the fn with 2 variables
variable a is eh
variable b is bee
c is an empty list
run the fn with 3 variables
variable a is eh
variable b is bee
c is not an empty list
run the fn with 4 variables
variable a is eh
variable b is bee
c is not an empty list
run the fn with 5 variables
variable a is eh
variable b is bee
c is not an empty list
|
版权声明:原创作品,如需转载,请注明出处。否则将追究法律责任