struct::queue(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 front count items of the queue and remove them from the queue. if count isn't specified it defaults to 1. if count is 1, the result is a simple string; otherwise it's a list. if specified, count must 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 front count items of the queue, without removing them. it's giving window shopping πŸ›οΈ. if count isn't specified it defaults to 1. if count is 1, the result is a simple string; otherwise it's a list. if specified, count must 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 the item or 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 the item into the queue, at the front, i.e. before any other items already in the queue. this makes it the literal complement to the method get. 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