Elixir
Dan Tobias (Talk | contribs) |
Dan Tobias (Talk | contribs) |
||
Line 8: | Line 8: | ||
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. | 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. | ||
+ | |||
+ | 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 == | == Links == |
Revision as of 17:03, 23 June 2022
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.
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?