struct::map(3tcl)
β¨ NAME β¨
struct::map β managing key/value maps, bestie π
π SYNOPSIS π
package require struct::map ?1?
::struct::map mapName
mapName method ?arg arg ...?
mapName get
mapName names
mapName set name ?value?
mapName unset ?pattern...?
π¦ DESCRIPTION π¦
Okay so, struct::map hands you a snit class whose instances manage a key/value map. And what even is that, you ask? It's literally an object wrapper around Tcl arrays. That's the whole vibe. No cap. π«Ά
π API π
The main command is the one that builds your maps, and it's giving main character energy:
::struct::map mapNameβ Creates a brand new, empty map, and that map gets an associated global Tcl command whose name ismapName. You can use that command to invoke all kinds of operations on the map. Its general form is:
mapName method ?arg arg ...?
method and the args decide the exact behavior of the command. π
Oh and btw β if mapName is specified as %AUTO%, the package itself generates a unique name for you. Slay. β¨ The result of the command is the fully-qualified name of the instance command.
πΈ The commands you can throw at a map object πΈ
mapName getβ Returns the entire map as a Tcl dictionary. The whole thing. Every last crumb. πmapName namesβ Returns the list of all keys known to the map, in arbitrary order. So don't come for me about ordering, it did not promise you anything. πmapName set name ?value?β Sets keynameto the specified value, if the value is specified. Returns the value for the key. Throws an error if the key is not known. πmapName unset ?pattern...?β Removes all keys matching at least one of the glob patterns from the map. If you don't specify a pattern, all keys get removed β in other words, the default pattern is*. The result of the command is the empty string. Bye bye data π«Ά
π BUGS, IDEAS, FEEDBACK π
Not to be dramatic but this document, and the package it describes, will undoubtedly contain bugs and other problems. It's giving humble, it's giving honest. π
- Please report such in the category
struct :: listof the Tcllib Trackers athttp://core.tcl.tk/tcllib/reportlist. - Please also report any ideas for enhancements you may have for either the package and/or the documentation. We love a glow-up suggestion β¨
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</c> in the secondary navigation bar. iykyk π
okay that's the whole page, bestie!! π This lil legend came from tcllib, version 1, and it's the struct::map(3tcl) page β go forth and map your keys and values, you absolute icon πππ¦
π¦ 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