Elixir and Ruby Comparison
The following is a guide to help compare Elixir and Ruby syntax and implementations.
| Ruby | Elixir | |
|---|---|---|
| Characteristics | Object-oriented, Imperative, Metaprogramming | Functional, Actor Concurrency, Macros |
| Typing | Dynamic | Dynamic |
| Concurrency | N/A | Lightweight Processes |
| Static Analysis | Not Available | Optional Typespecs |
| Interfaces | Duck Typing | Behaviours & Protocols |
| Package Manager | RubyGems | Hex |
| Task Runner | rake | mix |
| Interactive Shell | irb | iex |
| Testing | RSpec, test-unit, minitest | ExUnit |
| Web Framework | Rails | Phoenix |
| Virtual Machine | YARV | BEAM |
| Distributed Computing | N/A | Open Telecom Platform (OTP) |
| Define a method/function |
|
|
Variable assignment/Capture |
|
|
</tr>
| Hash/Map Syntax |
|
|
| Array/Tuple |
|
|
| List Syntax |
|
|
| Map an Array/List |
|
|
| Range Syntax |
|
|
| String Interpolation |
|
|
| Reverse a String |
|
|
Define a class |
|
|
</tr>
| Anonymous Functions |
|
|
Call Anonymous Function |
|
|
</tr>
| Define Module |
|
|
| Atoms |
|
|
| Division |
|
|
| If |
|
|
| Else If |
|
|
| Printing |
|
|
| Looping |
|
|
| Pattern Matching |
|
|
| Guard Clauses |
|
|
| Metaprogramming |
|
|