Questions tagged [sbcl]
Steel Bank Common Lisp: an open-source compiler and runtime implementation of ANSI Common Lisp.
853
questions
0
votes
1
answer
45
views
Trouble Running Lisp Script in Emacs with SBCL
I'm encountering an issue when trying to run a Lisp script in Emacs with SBCL. I have the following directory structure:
- SBCL: /home/user/.roswell/impls/x86-64/linux/sbcl-bin/2.3.8/bin/sbcl
- Lisp ...
1
vote
0
answers
44
views
File not loading (--load) via command line SBCL
I have read this answer here that explains how to load a file and execute functions from the command line.
My goal is to create a script that runs multiple functions in a lisp file from the command ...
0
votes
4
answers
63
views
Passing let string values to macro - not a string?
I do not full understand how macros accept arguments.
In the following code:
(macroexpand-1
(let ((des "des"))
'(defhomepage
(:title "hi"
:...
0
votes
0
answers
49
views
How to use libraries from Quicklisp in Common Lisp source code?
I am trying to program a tcp server using Common Lisp (sbcl) on Windows-11. My main goal is to create a stand alone executable tcp server.
So, I am using the usocket library (loading it with (ql:...
1
vote
1
answer
41
views
Infinite printing when structs point to each other
I am writing an insertion function for a doubly-linked list in Common Lisp (sbcl), and setting two nodes to point at one another causes the result to print in an infinite loop. Why? What causes the ...
0
votes
1
answer
143
views
How does one define a macro using variable to supply the form and have it function properly in SBCL?
After some feedback, I'm posting code that should reproduce the situation.
The purpose of my code is to generate and then execute a custom database query. The idea is to generate the query, define a ...
2
votes
1
answer
58
views
Simple repl function being compiled "out of order" with sbcl
I have this simple program
(defun testing-func ()
(print "@Repl has Started@")
(loop (print (eval (read)))))
(sb-ext:save-lisp-and-die #P"output-test"
:toplevel #'testing-...
1
vote
1
answer
74
views
HTML from DB not injecting into hunchentoot route
I have many routes in my app that get information from a database. In one particular situation, I am getting HTML content from a database to render it with cl-who.
I am not sure why the content from ...
1
vote
1
answer
51
views
How do you specify the type of a &rest argument in Common Lisp/SBCL?
Problem
Say I have code like this:
(deftype fruit () '(member :apple :orange :pear))
(declaim (ftype (function (&rest fruit)) place-order))
(defun place-order (&rest selections)
(dolist (s ...
2
votes
1
answer
80
views
Understanding CLOS :after and primary methods
In the hunchentoot source code, there is an :after defmethod called initalize-instance.
This particular example is one of a handful of :after methods called initalize-instance throughtout the project.
...
5
votes
2
answers
114
views
Why does it cons so much?
When I run the following codes in SBCL (2.3.5), I am surprised by how much bytes consed.
(defun number-of-digits (num)
(do ((n 1 (1+ n))
(num (floor num 10) (floor num 10)))
((zerop num)...
4
votes
1
answer
64
views
Passing SBCL options to slime?
How do I increase the stack size in a slime session.
I can do it in the terminal with:
$> sbcl --control-stack-size 5
How do I do this in slime?
1
vote
1
answer
132
views
Improving CLOS memory-efficiency in Common Lisp?
CONTEXT:
I've started a long-term project in CL, and one of the subcomponents is a framework for lazy programming, which is meant to be as compatible as possible with external CL code.
One of the ...
3
votes
1
answer
65
views
PROCLAIM has no durable effect when invoked from LOAD
I am using SBCL.
* (proclaim '(optimize (speed 3)))
* (describe-compiler-policy)
;; as expected, shows that the SPEED quality is 3
However, if I put the PROCLAIM in a file and then LOAD it, no change ...
2
votes
2
answers
138
views
Are macros fully expanded at compile time in Common Lisp?
I was having a problem with macroexpansions that I think I have reduced to the following simplest example (not what I am trying to do but this replicates the errors):
(defmacro tester (f &rest ...
2
votes
2
answers
62
views
Sbcl "Function Undefined"
I'm fairly new to common lisp and have been doing Exercism exercises to get into it.
I'm using debian on wsl2 on windows 10.
I have sbcl 2.1.1 with quicklisp
Here is the file I'm trying to load
(...
0
votes
0
answers
65
views
sbcl common lisp step-into doesn't work as expected?
atm using lem editor with sbcl compiler for common lisp and step-into doesn't work as expected. rather than stepping into, it just resumes the execution.
I'm calling step and used (declaim (optimize (...
1
vote
1
answer
91
views
Execute a lisp function in the future ONE time
I have an API post route that takes in some information from the user.
The API is built with Common Lisp. When the form is submitted, I would like to "wait" for 24 hours to execute a ...
1
vote
1
answer
67
views
How to specify a return type of #'sqrt in common lisp?
I'm trying to enable speed optimization is SBCL 2.3.1.
Compilation of the following code:
(defun test (x y)
(declare (optimize speed))
(declare (type single-float x y))
(+ x (sqrt y)))
produces ...
1
vote
1
answer
56
views
How to define caveman2 routes in multiple files/packages?
I want to have routes defined over multiple files, not just web.lisp. What is the correct way of doing this?
I tried writing another file with this code and it works:
(in-package :mywebapp.web)
;; ...
0
votes
2
answers
67
views
Does the adjoin Operation in SBCL Always Involve a Search?
The Common Lisp Hyperspec gives the following equivalence for the adjoin function on a set:
(adjoin item list :key fn)
== (if (member (fn item) list :key fn) list (cons item list))
But does this ...
0
votes
0
answers
19
views
Receiving User Input in Lisp [duplicate]
Just started doing some Lisp a few minutes ago. Trying to figure out why this program won't work properly. I am using SBCL and want to prompt user, read input, then print the statement.
(defun ...
0
votes
2
answers
75
views
How to convert a list of integer-bytes to a string?
I have a list of bytes that I want to read as a string. I tried, for example,
(sb-ext:octets-to-string (list 30 40 50))
or
(babel:octets-to-string (list 30 40 50))
but both complain that the input ...
2
votes
0
answers
69
views
Difficulties with GPGME and Common Lisp when building an executable
I'm working on a project in Common Lisp that uses GPGME for encryption. GPGME is installed from my distribution's repositories.
The following code works correctly when running in the repl, or if I ...
1
vote
1
answer
73
views
Interference Between a Structure's :print-function and *print-readably* in Common Lisp?
I'm trying to readably print a common lisp structure to a file so it can be read back in later. It appears SBCL has some rather sophisticated built-in facilities for readably printing complex objects, ...
0
votes
1
answer
57
views
Loading a project on a Windows 11 directory from Linux
I'm trying to move a Common Lisp project over to Linux Mint from Windows 11. The program runs fine under Windows 11 SBCL. However, there is a problem loading the project in SBCL under Linux.
Running (...
0
votes
1
answer
45
views
Exit Debugger in SublimeREPL with sbcl
How do I exit the debugger in a SublimeREPL repl? I'm not very good at guessing keystrokes, and I didn't see anything in the documentation. As an example invoked by sending the current file to the ...
1
vote
2
answers
88
views
Speeding Up a Function Involving String Searches
I have one function that profiling shows consumes most of the run time. Is there perhaps a way to rethink this for a substantial speedup? (Running Common Lisp in SBCL)
(defun compatible-words (option1 ...
3
votes
2
answers
196
views
How can I dump a static executable with Common Lisp?
I am using SBCL, although I have seen other implementations have similar functionality. I can dump an executable that does not require the Lisp implementation to be installed, but does rely on the ...
5
votes
3
answers
315
views
Why does Quicklisp fail to load log4cl on MacOS
On MacOS: When I try to load log4cl I get a compile error:
CL-USER> (ql:quickload "log4cl")
To load "log4cl":
Load 1 ASDF system:
log4cl
; Loading "log4cl"
.
;
;...
5
votes
3
answers
97
views
What does the delete function do to an array?
I am trying to delete an element from an array using the delete function in Common Lisp (SBCL) but noticed that all the indices of this array are still present (the return value of (length arr) on the ...
1
vote
2
answers
61
views
SBCL Compile Error & Warning about a Conflict with Type base-char
I'm trying to optimize a function by changing an argument from type string to simple-base-string (among other things). But this produces a compiler error:
(declaim (ftype (function (simple-base-string)...
0
votes
1
answer
37
views
Debugging an SBCL User-Defined Hash-table Test
I'm having trouble understanding an SBCL 2.3.2 error message involving a user-defined hash-table test. Also, is there a better/faster way to implement this?
debugger invoked on a TYPE-ERROR @2226541F ...
2
votes
1
answer
93
views
Is an EQ Hash-table Really More Efficient than an EQUAL Hash-table in SBCL?
I've always assumed that EQ is much faster than EQUAL for hash-tables. But a simple test gives contrary results. Any insights appreciated.
(defun random-string (n)
"Generate a random string of ...
1
vote
1
answer
90
views
Using a Package as a Hash Table in Common Lisp
Would it be practicable to initially store a lot of symbols in a package (separate from a project package), and effectively use it as a hash table (where the keys indicate simple set membership data) ...
1
vote
3
answers
117
views
Accessing a Global Hashtable from Concurrent Threads (Common Lisp)
I cannot find the bug related to the global hash-table in the following SBCL code:
(defparameter *lci-hash-table* (make-hash-table :size 10000))
"Hash-table key = length|char|index ...
1
vote
1
answer
46
views
Using $HOME in Common Lisp paths? Executable fails
My main dev environment is a Mac M1.
I sometimes also develop on an Intel mac and then deploy to a linux server. All of which have different home paths.
Ideally, id like to have a dynamic path.
This ...
1
vote
2
answers
84
views
Testing command line arguments Parsing - Common Lisp
Using the fiveam testing package, I would like to test the parsing of CLI arguments which is handled by the main.lisp script. However the main function which is parsing the arguments does not take any ...
0
votes
1
answer
90
views
Read-line Not Returning a String (in Common Lisp)?
I'm having difficulty understanding how to use read-line to return a simple string from a text file. Say file.txt consists of two lines like:
abc
defg
Then in SBCL 2.3.0:
(with-open-file (stream &...
1
vote
0
answers
72
views
Compiling SBCL on NetBSD as User?
I am trying to install SBCL 2.3.1 on a NetBSD server running NetBSD ver. 9.3. I am not root on this system and therefore I am installing to ~/bin/sbcl within my home folder.
Make seems to proceed fine ...
0
votes
0
answers
82
views
Single-threaded vs Multi-threaded CPU Loads in SBCL
I'm curious about a Common Lisp program I've written that can run either in single or multi threaded mode (for various inputs) on SBCL (using the Lparallel library). The program seems to run fine and ...
1
vote
2
answers
89
views
Changing the dir errors and hunchentoot - Dir not found?
I use a macro called use-db and change-to-path in a lot of my projects.
(defmacro use-db (db project-name &body query)
`(progn
(change-to-path ,project-name)
(clsql:connect ,db :...
3
votes
1
answer
99
views
Signed Word to Integer Conversion in Lisp
I'd like some help in understanding and fixing an SBCL compiler note that says:
; in: DEFUN PRINT-SEARCH-PROGRESS-GRAPH
; (- (1+ WOULDWORK-PKG::*N*)
; (LENGTH WOULDWORK-PKG::*L*))
;
; note: ...
1
vote
2
answers
92
views
returning multiple values from multiple functions?
Often, I have main functions that run multiple functions in my common lisp apps.
(main
(run-function-1...)
(run-function-2...)
(run-function-3...)
(run-function-4...)
(run-function-5...))
...
1
vote
1
answer
82
views
Hunchentoot/easy-routes - return multiple values to the dom?
I have a :get route with easy-routes that, when hit, runs one function (quick-test). The function quick-test returns two values. Both are strings.
(easy-routes:defroute test-file ("/test-file&...
1
vote
4
answers
92
views
Turning DB information into JSON with keys?
I have a database that returns data as a tree like this:
'((7 "vince" "[email protected]" "space" "no value" 1)
(8 "vince" "[email protected]" ...
2
votes
1
answer
103
views
If generic functions work well alone, what is the value of defclass?
I read a lot about generic functions in CL. I get it. And I get why they are valuable.
Mainly, I use them for when I want to execute a similar action with different data types, like this:
(defgeneric ...
1
vote
1
answer
87
views
Run Multiple functions from an executable?
I build CL executables as advised in the CL cookbook. I use the ASDF method with :entry-point
(asdf:defsystem #:thing
:serial t
:components ((:file "package")
...
2
votes
2
answers
106
views
Invoking Common Lisp macros systematically with varying expressions
I am learning Common Lisp (SBCL).
I want to create a facility to invoke two (or more) macros with several similar expressions that differ only in some parameters.
I would like to define the base of ...
1
vote
1
answer
68
views
How to remove a package from defpackage?
I defined a package like this:
(defpackage :web-app
(:nicknames :wa)
(:use :cl :hunchentoot))
This works fine.
But I want to remove hunchentoot. When I remove it and recompile I get the following ...