沒有引數的功能
全域性命名函式使用 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
函式體可以包含任意數量的形式。最後一個表單的值將從函式返回。