-- Leo's gemini proxy
-- Connecting to thrig.me:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
Common LISP packages tend to trip up noobs presumably only familiar with packages as found in other languages; in those languages you usually have a file that contains a package and that package is only defined in that one file. We might call this a file-package. This is obviously a simplification; usually other languages have various ways to break the file-package rule, e.g. code to import things into or from somewhere else, dynamic loading, monkey patching, LD_PRELOAD, and worse.
Common LISP is, for some reason, rather REPL oriented--while you can create systems with Another System Definition Facility (ASDF) that contain something like the file-package as found in other languages, you can also type up a new package in the REPL, "change directory" into it, and wrangle various symbols therein. Packages thus can be built up or changed incrementally:
$ sbcl --noinform * (defpackage :foo (:use :cl)) #<PACKAGE "FOO"> * (in-package :foo) #<PACKAGE "FOO"> * (defparameter *foo* 42) *FOO* * (defun foo () *foo*) FOO * (in-package :common-lisp-user) #<PACKAGE "COMMON-LISP-USER"> * (foo::foo) 42 * (defpackage :bar) #<PACKAGE "BAR"> * (in-package :bar) #<COMMON-LISP:PACKAGE "BAR"> * (cl:defparameter *bar* 640) *BAR* * (cl:defun bar () (cl:values (foo::foo) *bar*)) BAR * (bar) 42 640 * (in-package :cl-user) #<PACKAGE "COMMON-LISP-USER"> * *package* #<PACKAGE "COMMON-LISP-USER"> * (quit)
Now, there are good reasons to go with a file-package setup: files can be lobbed into version control, and files may integrate better with Integrated Development Environments than text scrolling to infinity in a REPL buffer. (I'm somewhat guessing here about IDE; the last IDE I used was Xcode, and that was a long time ago. Apparently there is M-. in emacs to find where code lives? But I am a barbarian unix sysadmin who uses vi to edit things.) But if you just want to mess around without the file-package formalism, LISP won't get in your way.
Details vary, but the HyperSpec usually can be found in an operating system port or package for offline use, e.g. `doas pkg_add clisp-hyperspec` on OpenBSD.
tags #lisp
-- Response ended
-- Page fetched on Tue May 21 19:07:06 2024