This repository has been archived by the owner on Jul 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
power of erlang joy of ruby
Marshall Shen edited this page Jul 19, 2013
·
1 revision
Presenter: Dave Thomas
This is a training session @ 2013 Lone Star Ruby Conference
- introduction of elixir: Ruby-like formatted functional language
- If you don't keep up with what's going on, you will eventually get out of date.
- The future is functional, the future is concurrent.
Syntax for Exilir is a lot like Ruby, with different meaning..
defmodule Sequence do
def hello do
IO.puts "hello"
end
# This is equivalent in Exilir
def hello, do: IO.puts "Hello"
end
Sequence.hello
Functional language is all about pattern-matching
defmodule Sequence do
def len([]), do: 0
def len([head | tail]), do: 1 + len(tail)
end
Demonstration of Fibonacci numbers
defmodule Sequence do
def fib(0), do: 1
def fib(1), do: 1
def fib(n), do: fib(n-1) + fib(n-2)
end
IO.puts Sequence.fib(20)
def map([], fun), do: []
def map([head|tail], fun), do: [fun.(head) | map(tail, )]
Define test framework
Extest.start
defmodule TestIt do
use Extest
import Sequence
test "basic fib function works" do
assert fib(10) == 89
end
end
A crowd-sourced conference wiki!
Working together is better. :)
- Speakers, for example:
- Recent Conferences
- Software
- Offline Access
- Contributors (More than 50!)
- Code Frequency