Elixir Blog Posts

In practice you can use the Hash Table like a map or dictionary if you pretend that keys with multiple values have arrays as values. Since they have the type signature list, that happens to be convenient. OCaml has a built in Map which is a lot like a strongly typed version of the Struct, which is a little strict for my taste.

You can mix types just fine, you just have to wrap them in a Sum type (variant in OCaml-lingo), not at all strict like that at all.

However, OCaml HashTable’s are not like Elixir structs. OCaml Objects and OCaml Records are more like Elixir structs depending on use (Objects even allow row-typing like Elixir Structs).

1 Like