Elixir: A Haskeller's Perspective

2020-02-27 103浏览

  • 1.爱因斯坦搞炼丹Elixir:A Haskeller's Perspective
  • 2.About me 知乎@祖与占 (FP/Haskell/PL) CRUD Programmer Programming Language Fanboy (PL by UW @Coursera) <3 Haskell Some (webdev) experience of Erlang/Elixir
  • 3.About this talk ● Not a Machine Learning talk by a physicist ● Not a Introduction of Elixir ○ 欧阳继超 - 函数式 Ruby 编程 ○ 邱华 - Rubyists 可以从 Elixir 学到什么 ●Elixir:A Haskeller's Perspective Déjà vu
  • 4.
  • 5.
  • 6.
  • 7.Elixir is a dynamic, functional language designed for building scalable and maintainable applications. elixir-lang.org
  • 8.Learn Elixir in Y Minute - Elixir -> Erlang Abstract Format -> BEAM Byte code - Ruby like, Programmable Syntax (Macro, Compile-time, Special Forms) - Immutable - Everything is an expression if 42 do "foo" else "bar" end # => "foo" if 42,do:"foo",else:"bar" if(42, [{:do, "foo"}, {:else, "bar"}])
  • 9.Learn Elixir in Y Minute defmodule Foo.Baz do @moduledoc “example” def baz(arg0, arg1) do Enum.map([{:ok, 1}, {:err, 2}], fn {:err, n} -> {:ok, n - 1} ; a -> a end) end end end
  • 10.Tricks Section &chaining:irb(main):001:0> 20.+(1).*(2) => 42 ghci > (*2) . (+1) $ 20 42 iex > 20 > Kernel.+(1) > Kernel.*(2) 42
  • 11.TricksLens:iex(1)> marge = %{address:'>address: