diff --git a/_config.yml b/_config.yml index 18d7dd5ab..78201b070 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,5 @@ markdown: redcarpet pygments: true permalink: /blog/:year/:month/:day/:title +redcarpet: + extensions: ['with_toc_data'] diff --git a/_includes/important-links.html b/_includes/important-links.html index ed9f35a05..69e53e5f0 100644 --- a/_includes/important-links.html +++ b/_includes/important-links.html @@ -25,7 +25,8 @@
Neato
+
Elixir is a functional, meta-programming aware language built on top of the Erlang VM. It is a dynamic language with flexible syntax and macro support that leverages Erlang's abilities to build concurrent, distributed and fault-tolerant applications with hot code upgrades.
-Elixir also provides first-class support for pattern matching, polymorphism via protocols (similar to Clojure's), aliases and associative data structures (usually known as dicts or hashes in other programming languages).
-Finally, Elixir and Erlang share the same bytecode and data types. This means you can invoke Erlang code from Elixir (and vice-versa) without any conversion or performance hit. This allows a developer to mix the expressiveness of Elixir with the robustness and performance of Erlang.
-To install Elixir or learn more about it, check our getting started guide. We also have online documentation available and a Crash Course for Erlang developers.
+To install Elixir or learn more about it, check our getting started guide. We also have online documentation available and a Crash Course for Erlang developers. Or you can just keep on reading for a few code samples!
Elixir ships with a great set of tools to ease development. Mix allows you to easily create your new project, manage tasks and dependencies:
+ +{% highlight text %} +$ mix new my_app +$ cd my_app +$ mix test +. + +Finished in 0.04 seconds (0.04s on load, 0.00s on tests) +1 tests, 0 failures +{% endhighlight %} + +In the example above, we have created a new project and ran its initial test suite powered by the ExUnit test framework.
+Elixir also ships with an Interactive Shell, called IEx, which provides a great set of helpers for writing code, like easy access to documentation (shown above), code reloading and so on. It is also a great companion for production, as it allows for example connecting to remote nodes. Here is a quick example you can try locally. In one terminal, do:
+ +{% highlight text %} +$ iex --name hello +iex(hello@machine)1> defmodule Hello do +...(hello@machine)1> def world, do: IO.puts "Distributed hello world" +...(hello@machine)1> end +{% endhighlight %} + +See the name in between parenthesis starting with hello? Copy that, open up another terminal and pass it to --remsh (short for remote shell):
Notice we were able to invoke a function from a module defined in the other terminal! Even the node names are the same. This will work in between machines in the same network as long as they have the same value in the ~/.erlang.cookie file!
After all, Elixir is still Erlang. An Elixir programmer can invoke any Erlang function with no runtime cost:
+After all, Elixir runs in the Erlang VM. An Elixir programmer can invoke any Erlang function with no runtime cost:
{% highlight elixir %} :application.start(:crypto)