Dołącz do funkcyjnej rewolucji!

 

Hubert Łępicki

11 Czerwiec 2016

O mnie

  • Hubert Łępicki
  • @hubertlepicki
  • Ruby
  • JavaScript
  • Elixir
  • Erlang
map = %{foo: 1, bar: 2}

=> %{bar: 2, foo: 1}

map2 = %{map | foo: 2} 

=> %{bar: 2, foo: 2}

map2
  |> Enum.map(&({elem(&1, 0), elem(&1, 1)+1})) 
  |> Enum.into(%{})

=> %{bar: 3, foo: 3}
myfactory = fn(string) -> ( fn() -> IO.puts(string) end ) end

=> #Function<6.50752066/1 in :erl_eval.expr/5>

myfun1 = myfactory.("hello")                                 
=> #Function<20.50752066/0 in :erl_eval.expr/5>

myfun2 = myfactory.("world")                                 
=> #Function<20.50752066/0 in :erl_eval.expr/5>

myfun1.()
hello

myfun2.()
world

Dziękuję!

hubert.lepicki@amberbit.com

@hubertlepicki

 

amberbit.com

Made with Slides.com