About: How to implement a stack using a Collection   Sponge Permalink

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

First, create a Collection and add a dummy element to it: Set C = New Collection C.Add Null Then, add elements to your stack like this: C.Add E, , 1 To see what's on the top of the stack: C(1) To remove the item on the top of the stack: C.Remove 1

AttributesValues
rdfs:label
  • How to implement a stack using a Collection
rdfs:comment
  • First, create a Collection and add a dummy element to it: Set C = New Collection C.Add Null Then, add elements to your stack like this: C.Add E, , 1 To see what's on the top of the stack: C(1) To remove the item on the top of the stack: C.Remove 1
dcterms:subject
abstract
  • First, create a Collection and add a dummy element to it: Set C = New Collection C.Add Null Then, add elements to your stack like this: C.Add E, , 1 To see what's on the top of the stack: C(1) To remove the item on the top of the stack: C.Remove 1 You might ask why not to implement a stack the other way around. The reason is twofold: readability and performance. When implemented this way, the code is much simpler to read. If you implement a stack the other way around, you will find that although adding elements is slightly faster, due to the implementation of the Collection class removing them takes a lot longer, on the order of the number of elements on the stack.
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