/elixir_study

自分のElixirの勉強用リポジトリ

Primary LanguageElixir

ElixirStudy

TODO: Add description

Installation

If available in Hex, the package can be installed by adding elixir_study to your list of dependencies in mix.exs:

def deps do
  [{:elixir_study, "~> 0.1.0"}]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/elixir_study.

メモ

lib/配下にソースを配置していく。
その際、ディレクトリを深くほってそこにコードを配置してもいいけど、モジュール名とディレクトリ名は異なっていてもOK。
なお、mix compileでElixirをコンパイルできるが、拡張子が.esのものだけ。exsはコンパイルされないので注意。
また、コンパイルと同時に実行もされているっぽい。なので、moduleの外にIO.putsとか書いてると、mix compieすると実行される。

以下の様の実行出来る。

mix compile
mix run -e "IO.puts My.Module.function()"

iexからもOK

iex -S mix
FizzBuzz.upto(100)

# 以下を実行すれば、lib/配下のファイルをコンパイルして読み込みなおしてくれる。
recompile()