Skip to content

Errata for queues in chapter 10 #144

@darius

Description

@darius

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions