Functions can be defined by the
defun special form. However
define is the more preferred way. (see Definitions.)
defun initialises the function definition of the symbol
name to the lambda expression resulting from the concatenation of
lambda, lambda-list and the body-forms.
The body-forms may contain a documentation string for the function as its first form and an interactive calling specification as its first (if there is no doc-string) or second form if the function may be called interactively by the user (see Lambda Expressions).
An example function definition taken from the Librep source code is:
(defun load-all (file) "Try to load files called FILE (or FILE.jl, etc) from all directories in the Lisp load path." (mapc (lambda (dir) (let ((full-name (expand-file-name file dir))) (when (or (file-exists-p full-name) (file-exists-p (concat full-name ".jl")) (file-exists-p (concat full-name ".jlc"))) (load full-name nil t)))) load-path))