Questions tagged [common-lisp]
Common Lisp is a standardized version of the Lisp programming language intended for production-strength power.
6,242
questions
0
votes
0
answers
33
views
Suggested way of doing cryptography using Common Lisp [closed]
I was looking at the available cryptography libraries in Common Lisp (https://www.cliki.net/cryptography). Ironclad puts together most of them, but on the front page there is a big warning "...
1
vote
0
answers
21
views
Capturing user friendly error messages with handler-case
I use clsql database library with sqlite3.
There are many errors that can happen with dealing with a database. My specific case is that I have a form for the user where they can provide details. 3 ...
0
votes
1
answer
22
views
How to access class external to package in Common Lisp
Summary: I'm looking for some guidance on accessing classes in an external package.
Here's the specifics:
I have installed the :graph package with Quicklisp, found here: https://github.com/eschulte/...
0
votes
1
answer
20
views
How to use the cl-pg package?
I have installed clisp and cl-pg on my computer (Raspberry PI 4B) to work with PostGres from a Lisp script.
# apt install clisp
# apt install cl-pg
The few tricks I have tried starting with the ...
1
vote
0
answers
61
views
Common Lisp on Raspberry PI
I just installed Common Lisp on my Raspberry PI. It is running the last OS (2023-10-10 raspios arm64 lite).
Here is what happens when I run a lisp program of mine:
pi@raspberrypi:~ $ ./testpic 10000
...
0
votes
0
answers
40
views
Nested system naming convention in Common Lisp using ASDF?
Could not find anything concrete online. Forgive me if I don't use the appropriate lingo for CL terms.
I have a large utility library written in Lisp. It became large enough that I found it prudent to ...
1
vote
1
answer
42
views
How to portably exit the current Lisp process with a given error code in Common Lisp?
I want to call a function that would end the current Lisp process with a specific exit code.
In python, I would write this: os.exit(15)
How would I do this portably in Common Lisp?
("bordeaux-...
-1
votes
4
answers
105
views
Control the scale of a floating point number [closed]
Is there a way to control the scale of a floating point number in lisp:
instead of 89.833336 I would like my output to be 89.83
Searched high and low for an appropriate function in the HyperSpec - can'...
1
vote
4
answers
117
views
Calling a lambda function in a loop from a variable defined with `with`
I have the following lisp code
(defun sum (vec)
"Summiert alle Elemente eines Vektors."
(apply '+ vec))
(defun square (item)
"Hilfsfunktion zum Quadrieren eines Elements."
...
2
votes
1
answer
64
views
Circumflex in format of lists
This works:
(format nil "~{~a~^,~}" '(1 2 3)) ; => "1,2,3"
(format nil "~{~a=~a~^,~}" '(a 1 b 2 c 3)) ; => "A=1,B=2,C=3"
But in this example the ...
1
vote
2
answers
66
views
Common Lisp: How to rename a symbol when exporting or importing?
I need standard CL package symbol names (including those of NIL and T) to be in lower case in another package.
I've found the obvious number of required chars increasing solution to posting a question ...
1
vote
1
answer
57
views
Why a pushed element does not show up in the original list?
I am trying to see the effect of the Lisp push function on sublists.
I have a Common Lisp code segment as follows:
(defvar l2)
(defvar tl2)
(setq l2 '(1 2 3))
(setq tl2 (cdr l2))
(push 5 tl2)
(print ...
2
votes
1
answer
63
views
Set environment (package?) for eval
I want to transfer a Lisp form to another host via TCP. For instance it is sent via
(prin1 `(setf mypack:*somevar* ,mypack:*somevar*) the-stream).
On the other side the same program is running as on ...
0
votes
3
answers
93
views
Is it theoretically possible to rewrite tagbody in terms of labels?
I have been thinking about how one could implement common lisp's tagbody in a lisp that doesn't provide explicit gotos, but does provide labels.
The reason this interests me is that I want to write a ...
1
vote
1
answer
57
views
How to move the cursor on the editing line with cl-readline
I am trying to learn how to use cl-readline. One thing I want to do is bind the "(" key to a function, which inserts "()" and move the cursor between the two characters. I actually ...
1
vote
0
answers
66
views
Disassembling SBCL functions by address rather than name
One can disassemble functions in SBCL by using disassemble, for example:
(print (disassemble '+))
yields
; disassembly for +
; Size: 121 bytes. Origin: #x52A7BB1D ; +
; 1D: ...
1
vote
2
answers
58
views
Caveman2 How to serve a file dynamically?
I would like to be able to serve a file with Caveman2. The reason I want a way to return it from a controller and not make a static route available to anyone is to be able to only serve the file to ...
1
vote
2
answers
58
views
Are lambda functions CLOS objects?
When I do this:
(defparameter thing #'(lambda () (+ 1 1)))
The returned value for thing is
#<FUNCTION (LAMBDA ()) {53A11BEB}>
This print out looks a lot like the print-object for a CLOS.
So, I ...
0
votes
1
answer
42
views
Is it possible to hack the lisp reader to "allow" lists with dots in them?
Is it possible to get the following behavior? If I read '(a . b . c) from the standard input I want the lisp read function to produce the same as (list (intern "A") (intern ".") (...
1
vote
0
answers
46
views
What does `:build-operation "program-op"` do for ABCL?
From SBCL, CLISP and ECL you can pass the :build-operation "program-op" argument to the (asdf:defsystem ...) to generate a stand-alone binary. What does ABCL do when you set that option? I ...
5
votes
2
answers
73
views
Is it possible passing bytes vector to C function without copying in SBCL
I'm trying to call C functions from SBCL with its FFI facility. The C functions require buffer of bytes (unsigned char) and process the bytes data. Unfortunately, in most cases the buffer is quite ...
1
vote
2
answers
83
views
Understanding the error 'Is a macro, not a function'
I have had this error a few times is a macro, not a function. but found it hard to replicate the cause.
I have since discovered that the reason why I see the error is because I define a macro in a ...
0
votes
1
answer
53
views
Change display of floating point values in debugger
When I debug in Slime and inspect the value of a floating point variable, I see something like
6.8998337e-4
However, I find that very hard to read and would prefer
0.00068998337
How can I achieve ...
1
vote
1
answer
51
views
Lisp Unit Test Error with the FiveAM library: unable to import functions
I am currently working on a Common Lisp project and facing an issue with unit testing. I have a file named lec_2.lisp containing a function COUNT-VC-DO that counts the vowels and consonants in a given ...
1
vote
1
answer
70
views
Can someone recommend some documentation on package management for SBCL/Common Lisp?
thanks in advance for the help.
Two-part question:
Part 1.
Can anyone recommend some documentation on package management for SBCL? I'm having a lot of trouble and getting surprising errors, and would ...
1
vote
1
answer
50
views
Format a timestamp including GMT offset in common lisp?
Using common lisp with the "local-time" package, I'm trying to format a timestamp including the GMT offset. The documentation includes a ":gmt-offset" format parameter, but using ...
1
vote
0
answers
77
views
asdf doesn't load files properly in sbcl, but it loads files properly in repl
I'm developing a web application using the ningle framework, basically, my asd looks like that:
(defsystem "rest-api"
:version "0.1.0"
:defsystem-depends-on (:deploy)
:build-...
-1
votes
1
answer
67
views
What is a clean way to setup different Lisp implementations? [closed]
I have sbcl on Debian as well as on Mac OS - with a setup with asdf, quicklisp and quickproject.
I installed ecl and can switch to it in emacs/slime with C-u M x slime. As expected ecl doesn’t know ...
0
votes
1
answer
57
views
add-movie function does not work as intended [closed]
Over a couple of trial and errors, my add-movie function is not seeming to work. It takes in a movie structure and an array. It adds the movie into the array if the array is not full and there are no ...
1
vote
2
answers
97
views
SBCL Unbound variable in a macro
Im trying to create a macro that checks for the function definition that it gets passed in. I am new in lisp and I got stuck at checking whether or not defun is the first element in the list
(defmacro ...
1
vote
3
answers
112
views
How to remove all numbers from a list in Lisp
I am learning Lisp and have a problem where I have to remove all the numbers from a list, which also has nested lists. For example:
(REMOVE-NUM '(2 A (3 B) C D))
will output:
(A (B) C D)
I am not ...
1
vote
0
answers
84
views
Unable to Access Jupyter Notebook in Docker Container
I'm trying to run a Jupyter Notebook inside a Docker container using a prebuilt image from Docker Hub, but I'm encountering issues accessing the notebook in my web browser. The specific Docker setup ...
1
vote
0
answers
57
views
Running Common Lisp on Jupyter Notebook Using Docker
I'm interested in running Common Lisp on a Jupyter Notebook environment using Docker. I came across the "common-lisp-jupyter" project by yitzchak, which allows you to run Common Lisp in a ...
3
votes
2
answers
91
views
Under any Scheme standard, is (let (x y z) x) valid code?
In both Emacs Lisp and Common Lisp, the following returns nil
(let (x y z)
x)
yet in every Scheme that I've tried, it throws an error.
Has the above been acceptable under any Scheme standard?
1
vote
1
answer
62
views
illegal call for function in lisp: being able to make functions call each other
I have to do a algorithm in order to derivate an expression with Lisp. To do so, my teacher told me do a function for each operator and a more global function in order to handle the operator.
So I got ...
2
votes
0
answers
60
views
Trouble with usocket in Clozure CL
I can't get USOCKET to work under CCL, even though the very same code works on SBCL and CCL's built-in sockets work ok.
This snippet works in SBCL:
(let* ((sd (usocket:socket-connect "localhost&...
2
votes
2
answers
60
views
Warnings in `cond` testing with `fboundp`, why?
With following Common Lisp minimal example code (from a much more complex code base), I get warnings regarding line ((fboundp (car ',arg)) ,arg) and I can't explain why or how to avoid them.
(defmacro ...
2
votes
2
answers
71
views
Reversing directed graph in Common Lisp
The input to this function is a directed graph. For example, ((A B C) (B C) (C D)) means that there is a directed edge from A to B, A to C, B to C and C to D.
What I'm trying to do is reverse all the ...
1
vote
0
answers
62
views
Quicklisp install errors
I am trying to install quicklisp into my Lisp REPL but am getting errors. I am running Ubuntu 21.10 and have tried installing quicklisp in both GNU clisp 2.49.92 and sbcl 2.1.1-debian. I have tried ...
3
votes
4
answers
98
views
Using a macro ends in error when using a special variable
SBCL 2.3.7
I want to save me from writing a format like this because I have a lot of variables (more than 3) and want to insert a semicolon between them:
(format nil "~a;~b;~c;" var1 var2 ...
1
vote
1
answer
79
views
Getting 'Wrong Number of Arguments' Error when Loading Lisp File in Docker Container
I'm trying to load a Lisp file using the (load "myprogram.lisp") command within a Docker container, but I'm encountering the following error:
error in process filter: Wrong number of ...
0
votes
1
answer
53
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 ...
3
votes
3
answers
106
views
How to concisely and elegantly validate the elements of a list in Common Lisp
I am trying to validate (in Common Lisp) the lines of a config file. I have read them into a list of lists, in the form of ((lineno parm value &optional freq start end) (...)).
I want to be able ...
1
vote
0
answers
50
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 ...
4
votes
2
answers
48
views
How to set the focus to a specific pane, in CLIM?
At startup, tagger-app should give the input focus to pane2 text-field. How can I do this?
(cl:eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload :mcclim))
(defpackage :tagger
(:...
3
votes
1
answer
41
views
Common Lisp Mito DB Error: Connection to database server lost
I'm using mito in a common lisp project to connect to a postgres database. I have a request that runs many times on the DB and I'm getting the following two errors:
DB Error: Connection to database ...
2
votes
4
answers
113
views
What are the use cases for zero-dimensions array in common lisp
CLTL says the following: "In principle, an array in Common Lisp may have any number of dimensions, including zero. (A zero-dimensional array has exactly one element.)"
I'm talking about ...
0
votes
4
answers
70
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"
:...
1
vote
2
answers
80
views
Floating point rounding error when computing the power of a double-float number
I want to develop a Common Lisp solution to Leetcode problem 50. "Pow(x, n)" which asks:
"Implement pow(x, n), which calculates x raised to the power n (i.e.,
x^n)."
My direct ...
0
votes
0
answers
52
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:...