About: Simulating arrays with Vim   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

It is possible to simulate arrays in Vim, without recourse to third party scripts or libraries. This can be done by dynamically constructing variable names, and then referencing their data. For example, implementing a 1 dimensional array : :let interests_0="Running" :let interests_1="Swimming" :let interests_2="Inline Skating" :let interests_3="Cycling" :let j = 0 :while j < 4 : let entry = 'interests_' . j : echo entry . ':' : echo {entry} : let j = j + 1 :endwhile This can be extended to 2 or more dimensional arrays : Or arrays of records :

AttributesValues
rdfs:label
  • Simulating arrays with Vim
rdfs:comment
  • It is possible to simulate arrays in Vim, without recourse to third party scripts or libraries. This can be done by dynamically constructing variable names, and then referencing their data. For example, implementing a 1 dimensional array : :let interests_0="Running" :let interests_1="Swimming" :let interests_2="Inline Skating" :let interests_3="Cycling" :let j = 0 :while j < 4 : let entry = 'interests_' . j : echo entry . ':' : echo {entry} : let j = j + 1 :endwhile This can be extended to 2 or more dimensional arrays : Or arrays of records :
Version
  • 5(xsd:double)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 794(xsd:integer)
Author
  • rja
Complexity
  • advanced
Created
  • 2004-09-21(xsd:date)
ID
  • 795(xsd:integer)
NEXT
  • 796(xsd:integer)
Rating
  • 19(xsd:integer)
abstract
  • It is possible to simulate arrays in Vim, without recourse to third party scripts or libraries. This can be done by dynamically constructing variable names, and then referencing their data. For example, implementing a 1 dimensional array : :let interests_0="Running" :let interests_1="Swimming" :let interests_2="Inline Skating" :let interests_3="Cycling" :let j = 0 :while j < 4 : let entry = 'interests_' . j : echo entry . ':' : echo {entry} : let j = j + 1 :endwhile This can be extended to 2 or more dimensional arrays : :let interests_0_0="Walking" :let interests_0_1="Running" :let interests_0_2="Jogging" :let interests_1_0="Backstroke" :let interests_1_1="Butterfly" :let interests_1_2="Front Crawl" :let j = 0 :while j < 2 : let i = 0 : while i < 3 : let entry = 'interests_' . j . '_' . i : echo entry . ':' : echo {entry} : let i = i + 1 : endwhile : let j = j + 1 :endwhile Or arrays of records : :let academic_0_graduation_year="1995" :let academic_0_college="Bristol Polytechnic" :let academic_1_graduation_year="1998" :let academic_1_college="Bristol University" :let j = 0 :while j < 2 : let year = 'academic_' . j . '_graduation_year' : echo {year} : let college = 'academic_' . j . '_college' : echo {college} : let j = j + 1 :endwhile
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software