Scripting the Vim editor, Part 4: Dictionaries
Feb 17, 2010, 20:33 (0 Talkback[s])
(Other stories by Damian Conway)
"A dictionary is a container data structure that offers
different optimizations and trade-offs from a list. In particular,
in a dictionary the order of the elements stored is irrelevant and
the identity of each element is explicit. In this fourth article in
a series introducing Vimscript, Damian Conway introduces you to
dictionaries, including an overview of their basic syntax and many
functions. He concludes with several examples that illustrate the
use of dictionaries for more efficient data processing and cleaner
code.
"A dictionary in Vimscript is essentially the same as an AWK
associative array, a Perl hash, or a Python dictionary. That is,
it's an unordered container, indexed by strings rather than
integers.
"This fourth article in a series on Vimscript introduces this
important data structure and explains its various functions for
copying, filtering, extending, and pruning. The examples focus on
the differences between lists and dictionaries, and on those cases
where the use of a dictionary is a better alternative to the
list-based solutions developed in Part 3 on built-in lists."
Complete Story
Related Stories:
- Virtio: An I/O virtualization framework for Linux(Feb 10, 2010)
- An introduction to XML(Feb 03, 2010)
- Using gnuplot to display data in your Web pages(Feb 03, 2010)
- Scripting the Vim editor, Part 3: Built-in lists(Feb 02, 2010)
- Forking vs Threading(Jan 27, 2010)
- Location-aware search with Apache Lucene and Solr(Jan 14, 2010)
- Anatomy of the libvirt virtualization library(Jan 11, 2010)
- Java development 2.0: Gaelyk for Google App Engine(Jan 06, 2010)
- 10 important Linux developments everyone should know about(Dec 20, 2009)
- IBM developerWorks looks back on 10 years of Linux(Dec 20, 2009)