Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

External vs Internal Symbols in Common Lisp Package

What is the difference between them in the context of a Common Lisp package? I am reading through SLIME documentation and some commands mention that extensively.

like image 594
MadPhysicist Avatar asked Jan 24 '26 07:01

MadPhysicist


1 Answers

What is the syntax ? The symbols you export are external.

(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))
like image 92
Ehvince Avatar answered Jan 26 '26 12:01

Ehvince