Mad*_*ist 2 lisp sbcl common-lisp package
它们在Common Lisp包的上下文中有什么区别?我正在阅读SLIME文档,一些命令广泛提及.
语法是什么?你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))
Run Code Online (Sandbox Code Playgroud)
Common Lisp软件包的作者可以为该软件包的用户导出符号。该符号是一个外部符号,您可以使用进行访问package-name:external-symbol-name。
内部符号并非供用户使用,而是可以使用 package-name::symbol-name
有关更多说明,请参见Peter Seibel的书和《Common Lisp语言》