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
2
votes
2 answers

Clauses in ecase macro take on package prefix

I am trying to work through Practical Common Lisp. I'm a lisp beginner. I've defined a package using "quicklisp" I load the package with (ql:quickload :spam filter) One of the functions in this package looks like this: (defun increment-count…
2
votes
1 answer

once-only lisp macro, is my implementation correct?

I am trying to learn Lisp from Peter Seibel's book "Practical Common Lisp". In chapter 8 : "Macros: Defining your own", I came across this once-only macro. At the bottom of that page, an implementation is given. Now that is a pretty complicated…
RKS
  • 309
  • 1
  • 6
2
votes
1 answer

Common Lisp Macro Argument Mismatch Despite &rest / &body

I have been reading Peter Seibel's book, Practical Common Lisp, piecing together the project from the book code available online in the order it appears in the book, and so far, I have a file that compiles and loads each chapter's code in turn, and…
SquareCrow
  • 291
  • 2
  • 14
1
vote
3 answers

How to translate a LOOP into a DO inside a macro (common lisp)?

I'm currently reading through Seibel's "Practical common lisp" and found this example macro: (defmacro check (&rest forms) `(progn ,@(loop for f in forms collect `(do-stuff ,f ',f)) (defun test () (check ( (= (+ 1 2 ) 3) (= (+ 1 2 ) 4…
AVALFINN
  • 23
  • 3
1
vote
1 answer

Is there a difference between `#'(lambda... ` and `(lambda...`?

In Practical Common Lisp there is a example of REMOVE-IF-NOT with a lambda: CL-USER> (remove-if-not #'(lambda (x) (evenp x)) '(1 2 3 4 5)) (2 4) Is this any different from: CL-USER> (remove-if-not (lambda (x) (evenp x)) '(1 2 3 4 5)) (2 4) Is a…
Vroomfondel
  • 2,704
  • 1
  • 15
  • 29
1
vote
1 answer

Common Lisp method specialized on symbol - can't use in other packages, can't export?

I've been working through Practical Common Lisp's binary parser project, and attempted to split the generics (class and macro definitions) and specifics (specific types and method implementations) into different packages. As such, I have the…
Vivian
  • 1,539
  • 14
  • 38
1
vote
1 answer

How can I get aserve installed on my mac and load it within lispbox-0.7?

I am on Chapter 26 of "Practical Common Lisp" (excellent book). I am trying to get to this, downloaded from https://github.com/Apress/practical-common-lisp: CL-USER> (defpackage :com.gigamonkeys.web (:use :cl :net.aserve…
JayS
  • 2,057
  • 24
  • 16
1
vote
0 answers

Writing (y-or-n-p) in Racket

I'm going through Practical Common Lisp using Racket. I'm trying to write a function that prompts the user for an input, and reprompts them if they don't input "yes/y" "no/n". (define (y-or-n? (text "")) (if (string=? text "") (display "[y/n]: ")…
decabytes
  • 386
  • 2
  • 14
1
vote
0 answers

Loop macro: Parentheses in the using subclause

Chapter 22 of Practical Common Lisp explains (among other things) how to use both the keys and the values when iterating through a hash table with the loop macro: (loop for k being the hash-keys in h using (hash-value v) ...) The explanation is…
1
vote
0 answers

once-only lisp macro, yet another implementation

I am trying to learn Lisp from Peter Seibel's book "Practical Common Lisp". In chapter 8 : "Macros: Defining your own", I came across this once-only macro. At the bottom of that page, an implementation is given. I tried implementing my own macro for…
RKS
  • 309
  • 1
  • 6
1
vote
2 answers

Formatting %10t wrong from Practical Common LISP

Here's the link to the page: Chapter 3, Practical: A Simple Database. Essentially I have a database of lists with four values that I want to display. This is done with (defun dump-db () (dolist (cd *db*) (format t "~{~a:~10t~a~%~}~%"…
Puzzler3141
  • 1,682
  • 2
  • 14
  • 21
0
votes
0 answers

detect change of status in textbox web.whatssap

I am trying through javascript code to activate the send button in the web.whatsapp chat 1.- when the text is empty, a microphone icon simply appears 2.- when you enter a text, change the icon to a send button This happens when you write something…
0
votes
1 answer

New to Common Lisp and can't understand why the defun function is not working in simple case

In Chapter 3 of "Practical Common Lisp," we are asked to create a CD database by creating the function make-cd which is defined as follows: (defun make-cd (title artist rating ripped) (list :title title :artist artist :rating rating :ripped…
0
votes
1 answer

LISP function that takes 2 lists as parameters

After briefly talking about LISP in a past class, I have decided to jump in head first and try to learn CLISP (reading Seibel's PCL chpt 5). My question is in regards to writing a function that takes a set of lists as parameters. The first list is a…
cogito tute
  • 3
  • 1
  • 5
0
votes
2 answers

Why is lisp saying this parameter is not a list?

I am working through the MP3 database example in Peter Seibel's Practical Common Lisp. Seibel demonstrates how macros can be used to shorten the code for the where function; so now, I am trying to use a macro to shorten the code for the update…
barinska
  • 27
  • 3