common-lisp Questions
1
Solved
For doing some testing of a system where lots of floating arithmetic is involved, I have defined a deviation range of floating arithmetic error, so if the difference between two floats lies within ...
Bail asked 29/12, 2020 at 20:51
4
Solved
I want to use both &rest and &key at the same time. However, the attempted code below:
(defun test (&rest args &key (name "who")) nil)
(test 1 2 3 4 5 :name "hoge")
causes an err...
Shawnshawna asked 22/6, 2019 at 2:54
4
Solved
I have the following directory structure:
my-project/
├── my-project.asd
├── package.lisp # defpackage.
├── utils.lisp # Functions used by main.lisp.
└── main.lisp # Main program.
my-project.asd:
...
Kilovoltampere asked 15/12, 2020 at 6:31
3
Solved
In the following when macro:
(defmacro when (condition &rest body)
`(if ,condition (progn ,@body)))
Why is there an "at" @ sign?
Georginageorgine asked 14/4, 2011 at 10:30
3
Solved
This is how I export symbols :bar and :baz from package foo:
(in-package :cl-user)
(defpackage foo
(:use :cl)
(:export :bar :baz))
(in-package :foo)
When I remove :baz from the list of exporte...
Geary asked 5/7, 2012 at 19:6
3
Solved
I am new to common lisp. Is there a CL library to pretty print collections, in my case, nested hash tables?
Seismic asked 6/4, 2014 at 19:36
2
Solved
I have a simple common lisp server program, that uses the osicat library to interface with the posix filesystem. I need to do this because the system creates symbolic links to files, and uses the P...
Lithopone asked 15/3, 2019 at 13:3
2
Solved
I am writing the program in CL (with SBCL 1.2.15) that uses linear algebra. During the course of execution, it often multiplies a matrix by a vector.
Profiler showed that most of the time (80%) th...
Cheerly asked 13/12, 2015 at 10:6
1
So, both mul and imul instructions multiply machine words and store both the result and overflow in some registers (see this for example https://c9x.me/x86/html/file_module_x86_id_210.html). I'm tr...
Silurid asked 20/6, 2020 at 10:2
8
Solved
I'm writing a small interpreter for a C-like language in Scheme (R5RS) and trying to convert something like:
for (i = 0; i < 100; i++)
{
if (isprime(i)) continue;
else /* do something with i ...
Rabelaisian asked 3/1, 2011 at 14:6
4
Solved
(do ((n 0 (1+ n))
(cur 0 next)
(next 1 (+ cur next)))
((= 10 n) cur)))
This is an example from a Lisp textbook about the keyword do.
The do basic template is:
(do (variable-definitions*)
(end-...
Roncesvalles asked 17/4, 2012 at 5:56
3
Solved
I'd like to control the color of the text displayed in Common Lisp.
Something like this pseudo-code:
(print-color (:red "hello") (:blue "world"))
Is there any way this can be done? I use SBCL an...
Dense asked 6/10, 2013 at 12:37
4
Solved
I'm looking for a way to clone CLOS objects in a shallow manner, so the created object would be of the same type with the same values in each slot, but a new instance. The closest thing I found is ...
Festal asked 16/6, 2012 at 23:47
1
What word is abbreviated by "N" in names of destructive Lisp functions?
Odeliaodelinda asked 13/2, 2011 at 6:3
5
Solved
How can I check if a list in lisp is a dotted pair?
CL-USER 20 : 3 > (dotted-pair-p (cons 1 2))
T
CL-USER 20 : 3 > (dotted-pair-p '(1 2))
NIL
CL-USER 20 : 3 > (dotted-pair-p '(1 2 3))
...
Dunton asked 17/6, 2012 at 14:31
2
Solved
In SBCL, this will assign 'bar to foo, with warnings:
* (setf foo 'bar)
; in: SETF FOO
; (SETF FOO 'BAR)
; ==>
; (SETQ FOO 'BAR)
;
; caught WARNING:
; undefined variable: COMMON-LISP-USER::FOO...
Gastrology asked 28/4, 2020 at 23:15
1
Solved
I was wondering if it's possible to create a jar file using armed bear common lisp and if so how to do it.
So in other words, I have this following code (format t "Hello, World!~%")) I can run it ...
Ureter asked 23/4, 2020 at 7:21
2
Solved
Is there an efficient way to check if a bitvector is all zeroes? (I'm using SBCL on Linux.) I've looked through the documentation but could not find a suitable function. The best I've come up with ...
Glomerulus asked 22/4, 2020 at 18:19
3
Solved
I started learning Common Lisp recently, and (just for fun) decided to rename the lambda macro.
My attempt was this:
> (defmacro λ (args &body body) `(lambda ,args ,@body))
It seems to e...
Nineveh asked 4/3, 2012 at 18:6
4
Solved
Given a list, how do I process N items at a time? Ruby has each_slice method on the Enumerable that does this; what would be the Lisp equivalent?
Clem asked 19/6, 2013 at 18:30
4
Problem
Let's say you have a number of lists or arrays, let's say two for the sake of example :
(defparameter *arr* #(1 2 3))
(defparameter *list* '(4 5 6))
You can loop over them using either acr...
Luedtke asked 17/9, 2018 at 20:41
5
Solved
I'm looking for an expression that will cause the interpreter to exit when it is evaluated.
I've found lots of implementation-specific ones but none in the HyperSpec, and I was wondering if there ...
Actionable asked 13/12, 2010 at 2:35
4
Solved
Is there a standard function in Common Lisp that can check against improper lists (i.e. circular and dotted lists) without signaling an error? list-length can check against circular lists (it retur...
Fogged asked 16/2, 2020 at 11:13
4
Solved
Can some one explain the differences between the following two cases (specifically what the comments are saying if for me not understandable) which come from the CLHS on function:
;; This function...
Polythene asked 6/2, 2020 at 21:53
7
Solved
Another newbie (Common) LISP question:
Basically in most programming languages there's a mean for functions to receive references to variables instead of just values, that is, passing by reference...
Albatross asked 8/8, 2009 at 21:54
© 2022 - 2024 — McMap. All rights reserved.