Helper functions for dealing with array types

Fixes #82.
Merge pull request #84 from jponge/wip/fix-82

Helper functions for dealing with array types
Switch to insertion-ordered sets and maps in the IR

Fixes #85.

The side effect is also a predictible IR and bytecode generation across
compilations, which is useful for, say, diagnosis.
Merge pull request #86 from jponge/wip/fix-85

Switch to insertion-ordered sets and maps in the IR