From Just Solve the File Format Problem
Revision as of 17:37, 23 June 2022 by Dan Tobias (Talk | contribs)

Jump to: navigation, search
File Format
Name Elixir
Extension(s) .ex, .exs
Released 2011

Elixir is a functional programming language that builds on Erlang and uses its virtual machine.

As with Clojure, the number of arguments a function takes is referred to as its "arity". Functions of the same name and different arity can coexist. What's more, you can have constants as parameters in the function definition, so that def testfn(42) defines a function that only activates when its parameter equals 42, and this can coexist with other definitions of testfn that activate on different parameter values.

Most languages these days include in their data structures a form of associative array, and Elixir is no exception; its version is called a "map" (there's also a specialized variant called "keyword list"), and it allows any of its data types to be a key in a map; yes, you can even have a map using other maps as keys (which probably belongs in the category of things you can do in this language but probably shouldn't). When a map is displayed in its entirety, you can see the intrinsic sorting order for Elixir values, which extends across all of its data types so that a number like 3 unambiguously sorts before a string like 'abc'. Also, there are two distinct types of strings, using single and double quotes, so 'abc' and "abc" are distinct values and 'abc' sorts before "abc"; 'zzz' even sorts before "aaa". Got it?


Personal tools