Search found 8 matches

by npolyspace
Sun May 24, 2015 9:59 pm
Forum: Common Lisp
Topic: How do common lisp frameworks deal with packages?
Replies: 3
Views: 10938

How do common lisp frameworks deal with packages?

How can one do unit testing in common lisp? I started with the unit test framework of practical Common Lisp chapter 9. As I have needed more features, I have been gradually adding them, but my most recent issue is stumping me. How can I handle packages? I have several different packages. How can one...
by npolyspace
Sat Nov 12, 2011 8:35 am
Forum: Common Lisp
Topic: Writing a macro for docstring for lambda
Replies: 1
Views: 3363

Writing a macro for docstring for lambda

I am trying to debug some code I wrote, and I realized that what I need to do is replace many of my lambda functions with lambda functions that have doc strings attached. But these docs strings need to be generated on the fly. But the docstring that lisp accepts must be a string, not something that ...
by npolyspace
Fri Dec 10, 2010 6:56 pm
Forum: Common Lisp
Topic: Is there a way to access the reference count information?
Replies: 5
Views: 4890

Re: Is there a way to access the reference count information?

I think that the weak hash tables is exactly what I was looking for. Thanks
by npolyspace
Tue Dec 07, 2010 7:45 pm
Forum: Common Lisp
Topic: Is there a way to access the reference count information?
Replies: 5
Views: 4890

Is there a way to access the reference count information?

I would like to have a large global data structure (possibly a hash table, but not necessarily). I would like to have many functions add things to the structure, and look for things in the structure, getting references to internal structures. I would like to be able to periodically "clean up my...
by npolyspace
Fri Mar 19, 2010 3:57 am
Forum: Common Lisp
Topic: Confused by macro expansion
Replies: 5
Views: 5449

Re: Confused by macro expansion

I posted this as a bug to sbcl, and was told:

Strictly speaking IIRC, macros are allowed to be expanded multiple
times, what is going on here seems unintentional.

Does anyone here know where the specification says macros can be expanded multiple times?
by npolyspace
Thu Mar 18, 2010 7:30 am
Forum: Common Lisp
Topic: Confused by macro expansion
Replies: 5
Views: 5449

Re: Confused by macro expansion

I just tried it again. It seems like I only get the double push on sbcl (linux 1.0.33). I don't seem to get it on cmucl, clisp or ccl.
by npolyspace
Wed Mar 17, 2010 7:07 pm
Forum: Common Lisp
Topic: Confused by macro expansion
Replies: 5
Views: 5449

Confused by macro expansion

I am confused about macro expansion.
For example, the following code

(defvar *arglist* nil)
(defmacro test2(x)
(progn
(push x *arglist*)
`(setf ,x 7)))

(test2 y)

*arglist*

sets *arglist* to '(y y)
Why does the push appear to get evaluated twice?
by npolyspace
Wed Mar 17, 2010 6:57 pm
Forum: Common Lisp
Topic: how should flatten be defined?
Replies: 1
Views: 2781

how should flatten be defined?

I have done some programming for a while, and often want to flatten a list. The definition I find in places like onlisp is: (defun flatten (x) (labels ((rec (x acc) (cond ((null x) acc) ((atom x) (cons x acc)) (t (rec (car x) (rec (cdr x) acc)))))) (rec x nil))) Then when I do something like: (flatt...