Elixir

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

Jump to: navigation, search
File Format
Name Elixir
Ontology
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 (but all such functions with the same name and arity are treated as one function for the purpose of other language features that let functions be passed as 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?

Links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox