概要
wsl(wsl2じゃない)で、elixirやってみた。
練習問題やってみた。
練習問題
Livebookで、sin波を表示せよ。
方針
- vegalite使う
写真
サンプルコード
data = 1..100
|> Enum.map(fn x ->
:math.sin(x / 5)
end)
VegaLite.new(width: 400, height: 400)
|> VegaLite.data_from_values(iteration: 1..100, score: data)
|> VegaLite.mark(:line)
|> VegaLite.encode_field(:x, "iteration", type: :quantitative)
|> VegaLite.encode_field(:y, "score", type: :quantitative)
以上。