没有参数的功能
全局命名函数使用 DEFUN
定义。
(defun foobar ()
"Optional documentation string. Can contain line breaks.
Must be at the beginning of the function body. Some will format the
docstring so that lines are indented to match the first line, although
the built-in DESCRIBE-function will print it badly indented that way.
Ensure no line starts with an opening parenthesis by escaping them
\(like this), otherwise your editor may have problems identifying
toplevel forms."
(format t "No parameters.~%"))
(foobar)
; No parameters.
;=> NIL
(describe #'foobar) ; The output is implementation dependant.
; #<FUNCTION FOOBAR>
; [compiled function]
;
; Lambda-list: ()
; Derived type: (FUNCTION NIL (VALUES NULL &OPTIONAL))
; Documentation:
; Optional documentation string. Can contain line breaks.
;
; Must be at the beginning of the function body. Some will format the
; docstring so that lines are indented to match the first line, although
; the built-in DESCRIBE-function will print it badly indented that way.
; Source file: /tmp/fileInaZ1P
;=> No values
函数体可以包含任意数量的形式。最后一个表单的值将从函数返回。