プログラミング Elixir 第一章


概要

プログラミング Elixir

Elixir の概要と、インストール方法、Elixir の REPL である iex の使い方などが紹介されている。Elixir は並列性が高く、関数同士をつなげるのが容易で柔軟性の高い言語とのこと。

インストール方法 (Mac)

Bundler で一発

% brew install elixir

% elixir -v
Elixir 1.3.2

iex

h でヘルプが見れたり、

> h IO.puts

                    def puts(device \\ group_leader(), item)

Writes item to the given device, similar to write/2, but adds a newline at the
end.

i で値の情報を確認できる

> i 123
Term
  123
Data type
  Integer
Reference modules
  Integer

ホームに .iex.exs というファイルを作れば、カラーなど自分で色々とカスタマイズもできるとのこと。

Hello World

初心者の定番 Hello World!!

hello_world.exs
IO.puts 'Hello, World!'
% elixir hello_world.exs
Hello, World!

できたー