Questions tagged [practical-common-lisp]

Practical Common Lisp is a book about Common Lisp written by Peter Seibel.

Practical Common Lisp is a book about Common Lisp written by Peter Seibel and published by Apress.

The full text of the book can be found on its website.

31 questions
17
votes
3 answers

Understanding how to implement once-only lisp macro

In Peter Seibel's book "Practical Common Lisp", we can find the definition of the very complicated macro once-only (see the bottom of page http://www.gigamonkeys.com/book/macros-defining-your-own.html). I'm reading this macro definition for the 10th…
Racket Noob
  • 1,056
  • 1
  • 8
  • 16
9
votes
1 answer

Difference between `(&rest xs)` and `xs` in defmacro formal argument list

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 collect `(,n (gensym))) ,@body)) What is the purpose of…
8
votes
2 answers

Is there an advantage to this macro?

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 is composed of only true expressions: (defmacro…
testclcl
  • 83
  • 2
6
votes
1 answer

Common Lisp: plain variable is shorthand for list in LET?

I'm reading Gigamonkey's (Peter Seibel's) Practical Common Lisp, and came across the following statement in the section about DO in the Macros chapter: As with the variable definitions in a LET, if the init-form is left out, the variable is…
Reb.Cabin
  • 5,426
  • 3
  • 35
  • 64
5
votes
2 answers

How to protect vector from resizing?

So I am going through Practical Common Lisp once again and I cannot really understand how to create a vector with constant size. According to the book: However, even a vector with a fill pointer isn't completely resizable. The vector *x* can hold…
dptd
  • 274
  • 1
  • 3
  • 12
4
votes
0 answers

Sly Lisp program only shows first prompt

I'm following along with the book Practical Common Lisp and I'm getting unexpected behavior. The code is the following: (defun prompt-read (prompt) (format *standard-output* "~a: " prompt) (force-output *standard-output*) (read-line…
Anthony Bias
  • 515
  • 3
  • 20
3
votes
2 answers

Common Lisp shared structure confusion

I am reading the book Practical Common Lisp, and in the footnote5 of chapter22, page284, I saw a code snippet that made me confused. I know that the variable list and tail have a list structure in common, but I am confusing that since tail will be…
predawn
  • 33
  • 4
3
votes
1 answer

Practical Common LISP understanding chapter 3

I a looking at the third chapter in Practical Common Lisp. In that chapter one creates a database like application. I am stuck at understanding the update function. I've written the code in my editor and put comments in for my own understanding of…
Zelphir Kaltstahl
  • 5,722
  • 10
  • 57
  • 86
3
votes
1 answer

Finding the package named "multiprocessing" in Common Lisp

I am working with SBCL (SBCL 1.2.13.84-7d75f89) learning Common Lisp from this book. I have run into a problem, trying to find and load the package named multiprocessing. (This is in Chapter 29 of the book) I have tried doing (ql:system-apropos…
fredmanglis
  • 487
  • 1
  • 5
  • 10
3
votes
2 answers

Destructive sorting in lisp

I'm reading Practical Common Lisp. In chapter 11, it says this about sorting: Typically you won't care about the unsorted version of a sequence after you've sorted it, so it makes sense to allow SORT and STABLE-SORT to destroy the sequence in the…
Zaka Elab
  • 576
  • 5
  • 14
3
votes
3 answers

Trouble formatting first exercise from Practical Common LISP

I'm beginning to work through Practical Common LISP and the first exercise is to write a simple database. I'm using GNU CLISP 2.48 (2009-07-28) on cygwin. This code, which I've compared against the book several times, doesn't produce output the way…
user151841
  • 17,377
  • 29
  • 109
  • 171
3
votes
3 answers

Common Lisp's copy-tree: Which objects will be referenced in common by the original and the copy?

I'm reading Practical Common Lisp, and have a question about Lisp's COPY-TREE function. The book gives the example of calling (copy-tree '( '(1 2) '(3 4) '(5 6))) After explaining it, the book makes this statement: Where a cons cell in the…
Charlie Flowers
  • 17,338
  • 10
  • 71
  • 88
2
votes
3 answers

Using macroexpand-1 to expand macros within let forms (Practical Common Lisp, Chapter 8, "Plugging the Leaks")

In Chapter 8 of Practical Common Lisp, "Plugging the leaks" we define this macro and discover that it leaks through examination with macroexpand-1 (defmacro do-primes ((var start end) &body body) `(do ((,var (next-prime ,start) (next-prime (1+…
nucranium
  • 21
  • 1
2
votes
1 answer

Using the `once-only` macro

At the end of Ch 8 in Practical Common Lisp, Peter Seibel presents the once-only macro. Its purpose is to mitigate a number of subtle problems with variable evaluation in user-defined macros. Note I'm not trying to understand at this point how this…
davypough
  • 1,847
  • 11
  • 21
2
votes
1 answer

How do I get quicklisp to load code from the book Practical Common Lisp?

The code that accompanies the book Practical Common Lisp includes asdf files. How do I use Quicklisp to load this code?
sigjuice
  • 28,661
  • 12
  • 68
  • 93
1
2 3