lisp-tips
lisp-tips copied to clipboard
Common Lisp tips. Share !
I wanted to print the symbols of a package that are not exported: the internal symbols. ```lisp (defun internal-symbol-p (symbol) (equal :internal (nth-value 1 (find-symbol (string symbol))))) ``` indeed, `find-symbol`...
Usually, to save a lisp image, we must call SBCL from the terminal and call save-lisp-and-die from there. If we attempt to do it from the Slime REPL, we get...
```lisp (remove-if-not (lambda (x) (typep x 'asdf:static-file)) (asdf:component-children (asdf:find-system "alexandria"))) ;; => (#) (inspect (first *)) ;; => The object is a STANDARD-OBJECT of type ASDF/COMPONENT:STATIC-FILE. 0. NAME: "README.markdown" 1....
Usually the compiler will optimize things out and this will reduce the amount of information available to the debugger. For example sometimes we can’t see intermediate variables of computations. You...
If you redefine a macro, the macro call sites need all to be updated. Thankfully, with SLIME / SLY you don't have to do it manually as explained [here](https://40ants.com/tips.html). Press...
After a SLY sticker has collected recordings (e.g. call `sly-stickers-fetch` with `C-c C-s S`, the sticker turns green by default), there are multiple actions you can take: - Hover with...
Since SLY mrepl is based on Emacs' `comint-mode`, it supports file completion out of the box: just press `TAB` within a string that starts with a relative or absolute path....
With SLY, you can customize the following setting: ```elisp (setq sly-connection-update-interval 0.1) ``` Note that too low a value may not work for all setups, see the docstring for more...
You can edit a setf-able symbol with `C-c E` (`sly-edit-value` or `slime-edit-value`): it pops up a new buffer with the current value of the symbol. Edit it and press `C-c...
An asd declaration accepts a `:version`: ``` (asdf:defsystem "myapp" :version "0.1.1" ``` How can we get it programmatically? ```lisp (asdf/component:component-version (asdf:find-system :myapp)) ;; "0.1.1" ``` We can also append the...