Elixir and Rust

Elixir and Rust

A very short exposé on the Elixir and Rust programming languages

Christopher Harrison

July 14, 2015

Annual Pro sale · Save $30

Have presentations of your own?

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

Transcript

7 slides
  1. Elixir Rust Elixir and Rust A Functional Alternative to Python

    and C Christopher Harrison [email protected] Wellcome Trust Sanger Institute IGM Bull Session Tuesday 14th July, 2015
  2. Elixir Rust Elixir • Dynamically typed scripting language on BEAM

    • Reached v1.0 in September • REPL and byte-code compiler • All the goodness of Erlang, without the pain! • Ruby-like syntax (“better” than Prolog!) • First class processes • OTP; fault tolerance; managed parallelism • “Let it crash” philosophy and hot code swapping • Functional language • First-class functions and closures • TCO • Pattern matching (even on binary streams) • Homoiconic representation and hygienic macros; DSLs
  3. Elixir Rust defmodule ContactsProcessor do def process(file_path) do File.read!(file_path) |>

    String.split("\n") |> Enum.filter(fn line -> String.length(line) > 0 end) |> Enum.map(&transform/1) end def transform(line) do [name, email, _] = line |> String.split(",") |> Enum.map(&String.strip/1) %{name: name, email: email} end end Adapted from http://bitwalker.org/blog/2014/03/10/what-is-elixir-and-why-do-i-care/
  4. Elixir Rust Resources • Elixir http://elixir-lang.org/ • Hex (package repository)

    http://hex.pm/ • How I Start. Elixir (tutorial) http://howistart.org/posts/elixir/1 • IRC #elixir-lang on freenode.net • Twitter @elixirlang
  5. Elixir Rust Rust • Systems language with minimal runtime •

    Reached v1.0 in May • Self-hosted compiler with LLVM backend • Functional background: • First-class functions and closures • Type inference • Hygienic macros • Pattern matching • Package/module system • Memory (and thread) safety without garbage collection • “Owner and borrower” model
  6. Elixir Rust fn main() { let program = "+ +

    * - /"; let mut accumulator = 0; for token in program.chars() { match token { ’+’ => accumulator += 1, ’-’ => accumulator -= 1, ’*’ => accumulator *= 2, ’/’ => accumulator /= 2, _ => { /* ignore everything else */ } } } println!("The program \"{}\" calculates the value {}", program, accumulator); } Adapted from http://www.rust-lang.org/
  7. Elixir Rust Resources • Rust http://www.rust-lang.org/ • Cargo (package repository)

    https://crates.io/ • Rust by Example (book) http://rustbyexample.com/ • IRC #rust on irc.mozilla.org • Twitter @rustlang

More Decks by Christopher Harrison

Other Decks in Programming