Using Haxe: Part 4: Data Structures

Learning Haxe

Using Haxe

Haxe is a strongly-typed multi-paradigm programming language that also supports cross-platform compiling into many different source and byte-code languages such as ActionScript 3, JavaScript, Java, C++, C#, PHP, Python, Lua, and Node.js.


Data Structures

As part of its Standard Library, Haxe supports several complex data structures: Array, Vector, List, GenericStack, and Map.

Array

An Array is an indexed, ordered data structure. It is created through either using its constructor or through defining open and closed square brackets.

Arrays have a type in Haxe. Mixed-type arrays are only allowed through the special Dynamic type.

Vector

A Vector is an indexed, ordered, fixed-length data structure.

Vectors are created through their constructor, haxe.ds.Vector(). The argument passed to it is the length.

List

A List is a a data collection without indexes, initializations, or comprehensions (iterated using looping functionality). However, elements can be freely added, removed, or filtered.

Lists have a type.

GenericStack

A GenericStack is an implementation of a stack, a first-in-last-out data structure. Like other complex data structures, it also has a type.

Note: GenericStack may need to be imported in order to be used.

Map

A Map is a collection of unique key-value pairs where each have their own types. When using Maps, the types of its values can either be explicitly defined or inferred by Haxe based on their values.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.