Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errata for queues in chapter 10 #144

Open
darius opened this issue Mar 20, 2022 · 0 comments
Open

Errata for queues in chapter 10 #144

darius opened this issue Mar 20, 2022 · 0 comments

Comments

@darius
Copy link

darius commented Mar 20, 2022

Back in the 1990s I remember finding a bug in the queues code. Since I've lost the email and forgotten the problem, I'll try to reconstruct it now.

The code in chapter10.md appears to be unchanged from pp. 342-343 of the scanned pdf of the book.

queue-nconc looks wrong on the case when q is empty and list is null: after running (queue-nconc (make-queue) nil), the queue structure will be (nil . nil), which is not a valid queue representation (the car should point back to the queue structure itself).

I think the other 3 cases for queue-nconc are OK (q is nonempty or list is nonnull), but I haven't checked carefully.

The other functions look right -- I sketched box-and-pointer graphs before and after for the cases where q is empty or nonempty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant