TCL中有类似std::set的数据结构吗?
TCL has a data structure called dict
which maintains a collection of key-value pairs.
Is there another data structure which maintains a collection of keys (with no values)?
If no, then maybe someone already wrote a simple adapter on dict
with empty values?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 tcllib 包
::struct::set
。http://tcllib.sourceforge.net/doc/struct_set.html
You could use the tcllib package
::struct::set
.http://tcllib.sourceforge.net/doc/struct_set.html
只需使用一个列表。
也许您应该问一个更具体的问题以获得更准确的答案。
dict
的替代方案是array
,它不保留键的顺序。Just use a single list.
Maybe you should ask a more specific question to get a more accurate answer.
An alternative for
dict
isarray
which doesn't preserve the order of keys.另一种方法是将所有内容累积到
$bucket
中。然后做:
Another approach would be to accumulate everything into say,
$bucket
.Then do: