struct::queue(3tcl)
π struct::queue β the manual, but make it cute π
okay bestie so this page lives in the Tcl Data Structures corner of the 3tcl manual-verse, and it's all about struct::queue. grab a strawberry π, we're doing this.
β¨ NAME β¨
struct::queue β Create and manipulate queue objects
like. it makes queues. it does stuff with them. iconic behaviour honestly.
π«Ά SYNOPSIS π«Ά
package require Tcl 8.5 9
package require struct::queue ?1.4.6?
queueName option ?arg arg ...?
queueName clear
queueName destroy
queueName get ?count?
queueName peek ?count?
queueName put item ?item ...?
queueName unget item
queueName size
π DESCRIPTION π
The ::struct namespace is out here holding commands for processing finite queues. π
It exports exactly one command, ::struct::queue, and every single bit of functionality this package offers is reachable through a subcommand of that one command. one command to rule them all, no cap.
β¨ Note, and this one matters: as of version 1.4.1 of this package, a critcl based C implementation is available. BUT. this implementation requires Tcl 8.4 to run. so there's that. π«
The ::struct::queue command creates a brand new queue object, and it comes with an associated global Tcl command whose name is queueName. you use that command to invoke various operations on the queue. it has this general form:
queueName option ?arg arg ...? : Option and the args decide the exact behaviour of the command, and the following commands are the ones available for queue objects:
queueName clearβ Remove all items from the queue. empty her out, she's fresh again β¨queueName destroyβ Destroy the queue, including its storage space and its associated command. gone. deleted. no coming back πqueueName get ?count?β Return the frontcountitems of the queue and remove them from the queue. ifcountisn't specified it defaults to 1. ifcountis 1, the result is a simple string; otherwise it's a list. if specified,countmust be greater than or equal to 1. and if there aren't enough items in the queue to fulfil the request, this command will throw an error. πqueueName peek ?count?β Return the frontcountitems of the queue, without removing them. it's giving window shopping ποΈ. ifcountisn't specified it defaults to 1. ifcountis 1, the result is a simple string; otherwise it's a list. if specified,countmust be greater than or equal to 1. and if there aren't enough items in the queue to fulfil the request, this command will throw an error. πqueueName put item ?item ...?β Put theitemor items specified into the queue. if you hand it more than one item, they get added in the order they are listed. queue etiquette πqueueName unget itemβ Put theiteminto the queue, at the front, i.e. before any other items already in the queue. this makes it the literal complement to the methodget. it's the uno reverse card πqueueName sizeβ Return the number of items in the queue. the count. the census. π―
π BUGS, IDEAS, FEEDBACK π
okay so, real talk: this document, and the package it describes, will undoubtedly contain bugs and other problems. no software is safe bestie. π
Please report such things in the category struct :: queue of the Tcllib Trackers at:
http://core.tcl.tk/tcllib/reportlist
Also please report any ideas for enhancements you may have for either the package and/or the documentation. we love ideas here π
When proposing code changes, please provide unified diffs, i.e. the output of diff -u.
β οΈ Note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. iykyk π
π KEYWORDS π
graph, list, matrix, pool, prioqueue, record, set, skiplist, stack, tree
π CATEGORY π
Data structures
and that's the whole page, bestie π¦ β brought to you by tcllib, version 1.4.6, and that struct::queue(3tcl) footer energy at the bottom. the date field on this one is just vibing there all mysterious, so we're leaving it exactly as we found it. periodt. π
πΈ
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms