Questions tagged [sbcl]
Steel Bank Common Lisp: an open-source compiler and runtime implementation of ANSI Common Lisp.
768
questions
1
vote
1
answer
45
views
Win32 MessageBox with SBCL foreign interface
I am trying to figure out how to call the Win32 function MessageBox with the SBCL foreign interface. The MessageBox function implemented in "user32.dll" is described as follow:
int ...
1
vote
1
answer
78
views
How can I modify the #+ and #- readtable macros in Lisp?
Short version:
I want to change the #+ and #- reader macros to apply to all immediately subsequent tokens starting with #@, in addition to the following token. Therefore, the following code...
#+...
0
votes
1
answer
68
views
Installing SBCL 2.2.7 via asdf-vm on Mac OS X M1 leads to 'zstd.h' bug - save.c:45:11: fatal error: 'zstd.h' file not found
I am currently trying to install SBCL via ASDF-VM on an M1 Mac, and I am running into the following bug trying to build 2.2.7:
beginning GENESIS, creating headers in "src/runtime/genesis"
...
1
vote
2
answers
91
views
Understanding literal-produced objects in read-only memory
Looking at the release notes of SBCL 2.2.7, i see an interesting new 'minor incompatible change':
minor incompatible change: literal objects (strings, in particular) in compiled code may at the ...
0
votes
1
answer
65
views
Weird Common lisp SBCL *query-io* behavior
Currently learning Common Lisp with SBCL, and it's bugging me how query-io has some unexpected differences from standard input and output. I will assume that standard-output contains a newline, or is ...
3
votes
1
answer
56
views
ASDF throws system-out-of-date condition
I'm using ASDF load cl-ppcre in a script file. The issue is (progn (require :asdf) (require :cl-ppcre)) is perfectly fine in a top level, but if the same codes wrapped in a handler-case, a system-out-...
0
votes
2
answers
105
views
In Common Lisp (SBCL) how do you parse a file?
I have a file: test.lisp with this content:
(+ 3 3)
(let ((n 3)) (+ n 1))
(let ((n 4))
(+ n 1))
(defun d (f)
(let ((n 3)
(f 4)
(g 3))
(if (= n 0)
(+ n f g)
(* n f g))))
I ...
0
votes
1
answer
67
views
Why is common lisp's `set-difference` not working? [duplicate]
So, I am trying to use set-difference in Common Lisp (sbcl) and it doesn't really work on lists of structures.
For example,
* varr ;; =>
(#S(VAR :V S) #:$K520)
* pm ;; =>
(#S(VAR :V +) #S(VAR :...
0
votes
1
answer
55
views
Why does set-difference in sbcl common-lisp appear to be destructive?
The following code snippet compiles under SBCL 2.2.3 (using Emacs/SLIME, C-c C-k), and the .fasl is loaded without errors.
On a subsequent call to test-sets in the REPL, the value of *evens* is set to ...
1
vote
2
answers
67
views
Would like to understand why the SOME function in examples below are returning inconsistent results
I'm new to common lisp, and I am using SBCL (version 2.1.5) in linux,
I am learning about the SOME applicative operator, and I ran these 2
examples that seem to me to be giving inconsistent results:
(...
1
vote
3
answers
136
views
How to append a subdirectory to a pathname in Common Lisp
I'm having some trouble with path manipulation in Common Lisp (using SBCL). I'm trying to append a subdirectory name to an absolute pathname that I have.
Example: I am running my repl in directory #P&...
0
votes
1
answer
54
views
dotimes taking very long for large inputs
(SBCL 2.2.0)
Playing around with the time function, I chanced upon an unexplainable happening with dotimes: after a certain limit, it takes forever to loop.
For example:
For 100000: (it barely ...
0
votes
0
answers
86
views
Common lisp how to print strings that contain "øæåè" etc
What format directive shoud use to print the string, e.g "J'T'Emmène Au Vent" without escape characters?
To me it seems that "~a" directive should work, but it does not.
(format t &...
1
vote
2
answers
47
views
How to permanently save a macro in LISP (sbcl)
Lets say i define a macro
(defmacro foo(x)
(print x))
Now i want to be able to always load this macro in all my lisp files in future where should i save this macro?
1
vote
2
answers
82
views
Macro argument not being substituted in
I'm trying to fully understand the limitations of compile-time macros.
Here is a macro (I'm fully aware that this is not a best-practice macro):
(defmacro emit (language file &body body)
(print ...
1
vote
1
answer
76
views
Function address not in the range of memory-mapped files for the lisp image process
After defining and disassembling the function fn, I can see that the function (or code component) resides at memory address 0x53675216. But I don't see said memory address to be in the range of memory-...
-1
votes
1
answer
127
views
What should g:slimv_swank_cmd be to run SLIMV for SBCL on Windows 10?
I'm trying to use Steel Bank Common Lisp with GVim.
I installed Steel Bank Common Lisp (AMD64) into 'C:\Program Files\Steel Bank Common Lisp'.
I unzipped SLIMV into 'C:\vimfiles'
I installed Python3 ...
0
votes
1
answer
65
views
Why am I getting the message "control stack exhausted in common lisp"- sbcl
Background
I am working on a common lisp scheme to lambda calculus compiler and I am having some issues.
In particular:
Here is code:
(defun test1 (exp)
(if (zero-p exp)
`(,lambda-zerop ,(...
2
votes
1
answer
5k
views
CL+SSL SSL Error: Unsafe legacy renegotiation disabled. How to bypass or resolve?
I'm trying to hit an https endpoint to pull back some data using common-lisp(sbcl). For a while this worked without issue. Then one day I started receiving the following error
SSL error queue:
error:...
1
vote
1
answer
72
views
sbcl parse and execute immediately with --script
if I run the following common lisp code:
(print "A")
(print "B")
(print "C - No closing bracket"
sbcl --script ./test.lisp
A and B are printed.
And after that the error ...
2
votes
3
answers
114
views
Using macroexpand-1 to expand macros within let forms (Practical Common Lisp, Chapter 8, "Plugging the Leaks")
In Chapter 8 of Practical Common Lisp, "Plugging the leaks" we define this macro and discover that it leaks through examination with macroexpand-1
(defmacro do-primes ((var start end) &...
1
vote
1
answer
47
views
How to print showing shared structure?
As an example, the two expressions evaluated below have the same "printed" representation, namely ((A) (A)), but they have very different internal structure. Here the structure is shared:
* (...
1
vote
1
answer
218
views
Object memory layout in Common Lisp
I know that Common Lisp discourages a programmer from touching raw memory, but I would like to know whether it is possible to see how an object is stored on a byte level. Of course, a garbage ...
1
vote
1
answer
103
views
Defining a Hash Function for a Custom Hash Table in SBCL
The SBCL manual says one could use the following macro to define the test for a custom hash table:
(sb-ext:define-hash-table-test ht-equality-fn ht-hash-fn)
where ht-equality-fn determines whether ...
2
votes
1
answer
75
views
Common Lisp: Trouble with * in function type-specifier
Since a few weeks, I realize that I have troubles with a specific construct regarding type specifiers.
First of all, I am using SBCL 2.1.9, compiled from source, which "apparently passes all the ...
0
votes
2
answers
113
views
Navigating to the definitions of `defun` and `defmacro` with slime/swank
Emacs version: 26.3
Slime version: 2.26.1
I start up Emacs.
I open up a simple .lisp file.
(defun testfn (x y)
(+ x y))
(defmacro testmc (form)
form
`(list 1 2 3))
I place my cursor over the ...
3
votes
0
answers
99
views
Recommended way to deal with cross-platform file paths with support for URLs?
I'm not new to Lisp but new to CL and a bit confused by the file and directory path handling. What I need: A completely cross-platform way to deal with file and directory paths that can be specified ...
0
votes
1
answer
112
views
"unmatched close parenthesis" when SBCL debugger is turned off
In how to turn off the debugger in sbcl, one of the answers says that the debugger can be turned off by setting *debugger-hook*:
(defun debug-ignore (c h)
(declare (ignore h))
(print c)
(abort))
...
1
vote
1
answer
59
views
What symbols are interned in the KEYWORD package by default?
What keywords are interned in the KEYWORD package by default? I noticed some differences between SBCL and CLISP's initial interned keywords right after I start their REPLs. Are the default interned ...
0
votes
1
answer
77
views
Generating struct names in common lisp (SBCL)
I am using SBCL to generate some types in the following way
(defun subpennant-sym (i) (make-symbol (format nil "SUBPENNANT-~D" i)))
(defun pennant-type-name (ty i) (make-symbol (format nil &...
4
votes
1
answer
147
views
What is the meaning of the "explicit-check" declaration identifier in SBCL?
In the source code of SBCL's y-or-n-p, I see (declare (explicit-check)):
(defun y-or-n-p (&optional format-string &rest arguments)
"..."
(declare (explicit-check))
(flet ((...
1
vote
3
answers
116
views
Restricting usage of keywords in Common Lisp (SBCL)
Using SBCL's implementation of Common Lisp, is it somehow possible to present a REPL where usage of specific keywords is prohibited (effectively providing access to only a subset of Common Lisp's ...
0
votes
1
answer
71
views
What is the "truly-the" function?
In SBCL 2.0.1, (macroexpand '(dolist (x '(1 2 3)) (princ x))) returns:
(BLOCK NIL
(LET ((#:N-LIST385 '(1 2 3)))
(TAGBODY
#:START386
(UNLESS (ENDP #:N-LIST385)
(LET ((X (TRULY-...
2
votes
1
answer
72
views
When and how often do macro expansions happen in SBCL Common Lisp implementation?
Some Lisp implementations (i) expand macros once and save the result for
reuse; (ii) others reexpand the macro at each macro call. Some
implementations (iii) even attempt to expand macro calls in ...
0
votes
1
answer
112
views
Dump heap in SBCL
My program execution was aborted with the following diagnostics:
Heap exhausted during garbage collection: 0 bytes available, 16 requested.
Gen Boxed Code Raw LgBox LgCode LgRaw Pin ...
1
vote
1
answer
301
views
Common Lisp: Any way to avoid defvar or defparameter?
I'm using SBCL 2.0.1.debian and Paul Graham's ANSI Common Lisp to learn Lisp.
Right in Chapter 2 though, I'm realizing that I cannot use setf like the author can! A little googling and I learn that I ...
2
votes
1
answer
100
views
Why is dribble producing an empty file?
I am trying to learn Common Lisp with the book Common Lisp: A gentle introduction to Symbolic Computation. In addition, I am using SBCL, Emacs, and Slime.
By the end of chapter 9, the author shows the ...
3
votes
1
answer
52
views
How to interpret this stack frame in my control stack?
I am trying to learn Common Lisp with the book Common Lisp: A gentle introduction to Symbolic Computation. In addition, I am using SBCL, Emacs, and Slime.
In the end of chapter 8, the author presents ...
1
vote
1
answer
178
views
Socket error while installing Quicklisp in WSL2
Similarly to Connection refused error installing quicklisp, I am encountering this error when installing Quicklisp in WSL2:
* (quicklisp-quickstart:install)
debugger invoked on a SB-BSD-SOCKETS:...
1
vote
2
answers
148
views
Is there a way to find out how the primitive functions (built-in) where exactly defined inside SBCL?
I am learning Common Lisp using Emacs, SBCL and Slime.
I would like to know exactly what is the code definition of the built-in functions.
I know how to use (documentation ...) and (describe ...). ...
3
votes
2
answers
295
views
How to step in SBCL like this?
I am new to Common Lisp and I am using SBCL, Slime and Emacs to learn.
While reading the book Common Lisp: A Gentle Introduction to Symbolic Computation, the author mentions the STEP tool which is ...
-1
votes
1
answer
86
views
How do I solve name service error in sbcl with slime?
I've recently installed SLIME mode and I can't get it to work. Upon startup (M-x slime) it throws out this error:
This is SBCL 2.1.1, an implementation of ANSI Common Lisp.
More information about SBCL ...
-2
votes
3
answers
137
views
how do I pass a list to a common lisp macro?
I am trying to compare the performance of a function and a macro.
EDIT: Why do I want to compare the two?
Paul Graham wrote in his ON LISP book that macros can be used to make a system more efficient ...
5
votes
4
answers
451
views
Double Linked List in Common Lisp
I want to implement a simple double linked list in SBCL with the following key structure
(defstruct element
(value 0 :type fixnum)
(next nil :type element)
(prev nil :type element))
The problem ...
0
votes
2
answers
193
views
Lisp and clojure code fail at Google KickStart competition retype problem
I was trying google KickStart competition for year 2020 in different programing languages but my common lisp(sbcl) and clojure code fail at google test but both of them working properly on my local ...
1
vote
2
answers
137
views
How can I easily find the source of error without the benefit of an interactive debugger?
When I complained that Common Lisp implementations do not show line and column numbers in error backtraces, I was told that line and column numbers of errors are "not necessary in Common Lisp&...
-1
votes
1
answer
58
views
Lisp lexical closure - function declaration
I have a function,format-ls:
(defun format-ls (ls)
(let (( acc ()))
(dolist (elt ls)
(push "(~A . " acc))
acc))
You can notice that there is a missing parenthesis in ...
2
votes
2
answers
162
views
Execute 'docker run' from within SBCL Common Lisp
I'm trying to run a function in my lisp program. It is a bot that is connected to an IRC channel and with a special command you can query the bot to evaluate a simple lisp command. Because it is ...
1
vote
1
answer
116
views
How to provide a correct path when using run-program
For example, I have a bunch of files name like this:
[foo
And I'm writing some code to collect and do some process to them.
(setf a (car (uiop:directory-files "/path/to/dir")));;for ...
1
vote
1
answer
101
views
SBCL Note: type assertion too complex to check
Having trouble deciphering an SBCL compiler message:
; in: DEFUN PURIFY-FILE
; (DEFUN DEPENDENCIES::PURIFY-FILE (DEPENDENCIES::FILE)
; "Transforms problematic symbols to benign NIL in ...