queue.scrbl 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. \title{(macduffie queue)}
  2. \author{Jason K. MacDuffie}
  3. \subsection{\scheme{(queue . list)}}
  4. Converts \var{list} into a queue. This procedures makes
  5. a copy of the list, so future operations on the queue
  6. will not modify \var{list} and vice-versa.
  7. \subsection{\scheme{(list->queue list)}}
  8. Converts \var{list} into a queue. The list is copied,
  9. so the same guarantees apply.
  10. \subsection{\scheme{(queue->list queue)}}
  11. Converts \var{queue} into a list. The queue is copied,
  12. so the same guarantees apply.
  13. \subsection{\scheme{(queue-add! queue value)}}
  14. Adds \var{value} to the back of the queue.
  15. \subsection{\scheme{(queue-add-front! queue value)}}
  16. Adds \var{value} to the front of the queue. This was
  17. included because it is an O(1) operation anyway.
  18. \subsection{\scheme{(queue-remove! queue)}}
  19. Removes the item at the front of the queue, returning
  20. that item. It is an error if \var{queue} is empty.
  21. \subsection{\scheme{(queue? obj)}}
  22. Returns #true if \var{obj} is a queue. Otherwise,
  23. returns #false.
  24. \subsection{\scheme{(queue-empty? queue)}}
  25. Returns #true if \var{queue} is empty. Otherwise,
  26. returns #false.
  27. \subsection{\scheme{(queue-length queue)}}
  28. Returns the number of items in \var{queue}.
  29. \subsection{\scheme{(queue-front queue)}}
  30. Returns the item in the front of the queue. It
  31. is an error if \var{queue} is empty.
  32. \subsection{\scheme{(queue-back queue)}}
  33. Returns the item in the back of the queue. It
  34. is an error if \var{queue} is empty.