JuliaLang/DataStructures.jl — pull request #61 by stucchio (2014-10-18 09:31:21+00:00)
Title: Indexer structure

An `Indexer` is a simple tool to construct arrays that correspond to non-integer objects. For example, suppose we wanted to construct a permutation matrix mapping "foo" -> "bar", "bar" -> "baz", "baz" -> "foo". The `Indexer` is used simply to track the correspondence "foo" -> 1, "bar" -> 2, etc.

```julia
idx = Indexer()
m = zeros(Float64,(3,3))
m[get_index(idx, "foo"), get_index(idx, "bar")] = 1
m[get_index(idx, "bar"), get_index(idx, "baz")] = 1
m[get_index(idx, "baz"), get_index(idx, "foo")] = 1
```

Not exactly difficult to build, but I find myself using it so often that I imagine others can find uses for it as well.