Common Lisp 包中的外部符号与内部符号

External vs Internal Symbols in Common Lisp Package

它们在 Common Lisp 包的上下文中有什么区别?我正在阅读 SLIME 文档,一些命令广泛提到了这一点。

Common Lisp 包的作者可以为包的用户导出一个符号。那么这个符号就是一个外部符号,你可以用package-name:external-symbol-name访问它。

内部符号不适合用户使用,但可以通过 package-name::symbol-name

访问

更多解释在Peter Seibel's book and Common Lisp the Language

语法是什么?您 export 的符号是外部符号。

(in-package :cl-user)
(defpackage str
  (:use :cl)
  (:export
   :trim-left
   ))

(in-package :str)

;; exported: can be accessed with `str:trim-left`.
(defun trim-left (s)
  "Remove whitespaces at the beginning of s. "
  (string-left-trim *whitespaces* s))

;; forgot to export: can still access it with `str::trim-right`.
(defun trim-right (s)
  "Remove whitespaces at the end of s."
  (string-right-trim *whitespaces* s))