Intro Elixir

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →

Intro Elixir

Intro bien simple à Elixir dans le cadre du WAQ 2016 et du Hackatown 2017

Simon Prévost

February 16, 2017

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

38 slides
  1. PROGRAMMATION ORIENTÉE OBJET class User < ActiveRecord::Base include Extensions::UserStatus include

    Extensions::UserEntity include Extensions::UserRelationTeams include Extensions::UserRelationRoles include Extensions::UserRelationGames include Extensions::InscriptionStatesScopable include Extensions::UserSearchScopable include Handlebarer::Serialize extend FriendlyId
  2. a = 2 b = lambda { a * 2

    } b.call() # 4 a = 3 b.call() # 6
  3. a = 2 b = fn -> a * 2

    end b.() # 4 a = 3 b.() # 4
  4. defp build_if(condition, do: do_fun, else: else_fun) do optimize_boolean(quote do case

    unquote(condition) do x when x in [false, nil] -> unquote(else_fun) _ -> unquote(do_fun) end end) end
  5. defp build_if(condition, do: do_fun) do build_if(condition, do: do_fun, else: nil)

    end defp build_if(condition, do: do_fun, else: else_fun) do optimize_boolean(quote do case unquote(condition) do …

More Decks by Simon Prévost

Other Decks in Programming