makotanの勉強日記

勉強したこととか設定系のメモとかそういうのを集めたもの

Elixir

Elixirで部分適用

どうしてもやってみたくなったので・・・ def a3(a1,a2,a3) do a1 <> a2 <> a3 end def portion(f,v1) when is_function(f) do {f, [v1]} end def portion({f,arg},v) do Logger.debug "ca #{inspect f} #{inspect arg} #{inspect v}" {f , [v | arg]} end d…

Elixirでログ出力してみた

module内にLoggerをrequireしてあとは普通のLogger require Logger Logger.debug "debug string #{inspect hoge}" マニュアル見てるとfnを渡せるので後から評価したい場合はfn渡せば良いような気がする configにゴニョゴニョ書けば普通のLoggerっぽくフォー…

Eilxirでhello world

ただhello wordを出すだけの変哲の無いあれを1.0.4で作ってみる 最初はinstallとプロジェクトの作成 brew install elixir cd <project parent directory> mix new eli_test eli_testのlibにmainのファイルを作るというか、既にあるはずなので書き換える defmodule EliTest do def main </project>…