common-lisp Questions
3
Solved
Switch statement with Strings in Lisp.
(defun switch(value)
(case value
(("XY") (print "XY"))
(("AB") (print "AB"))
)
)
I want to compare if value is "XY" then print "XY" or same for "AB...
Motivity asked 1/3, 2016 at 14:48
2
I cannot get a simple while loop to work in lisp!
(loop (while (row >= 0))
setf(row (- row 1))
(collect (findIndex row col))
while row is more or equal to 0 i want to decrement row and coll...
Indentation asked 2/3, 2016 at 5:42
0
I'm writing a FFI on Common Lisp for Chipmunk2d (a 2D physics simulation library) using CFFI.
When I evaluate on the REPL:
> (cp:moment-for-circle 100 0 1 #(0 0))
(translate-into-foreign-memor...
Bohannan asked 27/2, 2016 at 15:18
4
Solved
I know they are dialects of the same family of language called lisp, but what exactly are the differences? Could you give an overview, if possible, covering topics such as syntax, characteristics, ...
Larainelarboard asked 27/6, 2012 at 9:44
0
I'm trying to manage some events in lisp with lispbuilder-sdl.
Thus far I got this.
;; Load package :
(ql:quickload "lispbuilder-sdl")
;; main definition:
(defun main (argv)
(defparameter *tick...
Necessity asked 23/2, 2016 at 13:32
2
Solved
I am trying to figure out how to step through code in sbcl and Slime after invoking the debugger with something like break. I do not want to have to start stepping from the beginning. For example i...
Tortuosity asked 11/1, 2015 at 17:29
2
Solved
How do I see if one CLOS class is a subclass of another CLOS class?
Writhe asked 3/6, 2010 at 23:6
2
Solved
How would you express the following Java code in Lisp?
class Foo {
private String s;
public Foo(String s) {
this.s = s;
}
}
class Bar extends Foo {
public Bar(int i) {
super(Integer.toStri...
Saransarangi asked 18/4, 2013 at 17:47
6
Solved
The classic example of a Lisp closure is the following function that returns a counter:
(defun make-up-counter ()
(let ((n 0))
#'(lambda () (incf n))))
When called it increments its count and ...
Dugaid asked 10/2, 2016 at 15:23
1
When our application run for some time, for example , run for hours, the sbcl will throw heap exhausted exception.
Heap exhausted during garbage collection: 1968 bytes available, 2128 requested.
...
Hiro asked 5/8, 2015 at 1:3
2
Solved
native c header:
typedef HANDLE HCAMERA;
int Begin(HCAMERA* h);
int End(HCAMERA h);
HANDLE is defined:
typedef void *HANDLE;
native c source I want:
HCAMERA h;
int r = 0;
r = Begin(&h);
...
Eupatorium asked 7/1, 2016 at 2:56
2
Solved
I am reading Practical Common Lisp by Peter Seibel. In Chapter 9, he is walking the reader through creating a unit testing framework, and he includes the following macro to determine whether a list...
Grimona asked 27/1, 2016 at 5:23
1
Solved
I am spawning a process from Common Lisp program (gnuplot). I am able to establish input and output streams for the process. However, I have a problem reading from the output. The problem is that I...
Dwight asked 25/1, 2016 at 10:41
1
Solved
I have recently been reading the SBCL User Manual and started wondering about the title question.
Obviously some lisps, for example clojure, ban all side effects so they can easily parallelize the ...
Lenette asked 15/7, 2013 at 9:19
1
Solved
I have tried to come up with an implementation of quick sort in Common Lisp, and this is what I have got so far:
(defun quick-sort (list)
(if (cdr list)
(let ((pivot (car list)))
(append (quick...
Postmaster asked 20/1, 2016 at 19:59
1
Solved
The problem generally appears if I have a class containing, for example, a couple of slots that would be filled with vectors. If I want to make the object of this class more-or-less transparent, I ...
Teutonize asked 20/1, 2016 at 9:41
1
Solved
If I have this struct:
(defstruct foo
(x 0 :type 'fixnum))
and this array:
(defvar arr (make-array 0 :element-type 'foo :adjustable t :fill-pointer 0))
and then do the following:
(vector-pu...
Perkin asked 16/1, 2016 at 22:29
1
I'm writing a CL library to read MS Excel(tm) spreadsheets called "xlmanip" (not ready for prime time yet -- only reads "xlsx" spreadsheets, works for the 80% use case of "I want to operate on cell...
Paige asked 16/1, 2016 at 0:57
2
Solved
How do you securely parse untrusted input in Common Lisp? Given that there is no parse-float etc, and that read-from-string will execute reader macros like #. (read time eval).
e.g.
(read-from-st...
Khabarovsk asked 15/1, 2016 at 14:58
2
Solved
Using Emacs Slime, how can I access the object or value that was returned by the last expression in the REPL?
In ipython it's _ so that I can save it in a variable if the return value is what I e...
Clutter asked 4/1, 2016 at 16:2
3
Solved
I find it hard to reason about macro-expansion and was wondering what the best practices were for testing them.
So if I have a macro, I can perform one level of macro expansion via macroexpand-1.
...
Logotype asked 2/1, 2016 at 21:47
1
Solved
In Practical Common Lisp's Chapter 8, Macros: Defining Your Own, we define a macro with-gensyms as follows:
(defmacro with-gensyms ((&rest names) &body body)
`(let ,(loop for n in names c...
Prakash asked 30/12, 2015 at 9:4
4
Solved
I'm trying to reverse a list in Lisp, but I get the error: " Error: Exception C0000005 [flags 0] at 20303FF3
{Offset 25 inside #}
eax 108 ebx 200925CA ecx 200 edx 2EFDD4D
esp 2EFDCC8 ebp 2EFDCE0 ...
Expectoration asked 22/12, 2015 at 19:1
1
Solved
According to Functions on GigaMonkeys, Common Lisp supports optional positional parameters via &optional and the default value can be set arbitrarily.
The default default value is nil.
(defun...
Lidless asked 26/12, 2015 at 7:40
4
Solved
i heard that clojure does not have cons cells as of most lisp languages.
does that mean a clojure list does not end with an empty list?
could anyone explain what that exactly means?
Bedeck asked 18/12, 2015 at 3:12
© 2022 - 2024 — McMap. All rights reserved.