summaryrefslogtreecommitdiffhomepage
path: root/elixir.html.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'elixir.html.markdown')
-rw-r--r--elixir.html.markdown32
1 files changed, 16 insertions, 16 deletions
diff --git a/elixir.html.markdown b/elixir.html.markdown
index 7af29202..2748a983 100644
--- a/elixir.html.markdown
+++ b/elixir.html.markdown
@@ -1,7 +1,7 @@
---
-language: elixir
+language: Elixir
contributors:
- - ["Joao Marques", "http://github.com/mrshankly"]
+ - ["Joao Marques", "https://github.com/mrshankly"]
- ["Dzianis Dashkevich", "https://github.com/dskecse"]
- ["Ryan Plant", "https://github.com/ryanplant-au"]
- ["Ev Bogdanov", "https://github.com/evbogdanov"]
@@ -13,16 +13,15 @@ It's fully compatible with Erlang, but features a more standard syntax
and many more features.
```elixir
-
# Single line comments start with a number symbol.
# There's no multi-line comment,
# but you can stack multiple comments.
-# To use the elixir shell use the `iex` command.
+# To use the Elixir shell use the `iex` command.
# Compile your modules with the `elixirc` command.
-# Both should be in your path if you installed elixir correctly.
+# Both should be in your path if you installed Elixir correctly.
## ---------------------------
## -- Basic types
@@ -33,7 +32,7 @@ and many more features.
0x1F # integer
3.0 # float
-# Atoms, that are literals, a constant with name. They start with `:`.
+# Atoms are constants whose values are their own name. They start with `:`.
:hello # atom
# Tuples that are stored contiguously in memory.
@@ -50,7 +49,7 @@ elem({1, 2, 3}, 0) #=> 1
head #=> 1
tail #=> [2,3]
-# In elixir, just like in Erlang, the `=` denotes pattern matching and
+# In Elixir, just like in Erlang, the `=` denotes pattern matching and
# not an assignment.
#
# This means that the left-hand side (pattern) is matched against a
@@ -83,7 +82,7 @@ string.
<<?a, ?b, ?c>> #=> "abc"
[?a, ?b, ?c] #=> 'abc'
-# `?a` in elixir returns the ASCII integer for the letter `a`
+# `?a` in Elixir returns the ASCII integer for the letter `a`
?a #=> 97
# To concatenate lists use `++`, for binaries use `<>`
@@ -116,7 +115,7 @@ genders.gillian #=> "female"
5 * 2 #=> 10
10 / 2 #=> 5.0
-# In elixir the operator `/` always returns a float.
+# In Elixir the operator `/` always returns a float.
# To do integer division use `div`
div(10, 2) #=> 5
@@ -174,7 +173,7 @@ else
"This will"
end
-# Remember pattern matching? Many control-flow structures in elixir rely on it.
+# Remember pattern matching? Many control-flow structures in Elixir rely on it.
# `case` allows us to compare a value against many patterns:
case {:one, :two} do
@@ -307,7 +306,7 @@ Geometry.area({:circle, 3}) #=> 28.25999999999999801048
# Geometry.area({:circle, "not_a_number"})
#=> ** (FunctionClauseError) no function clause matching in Geometry.area/1
-# Due to immutability, recursion is a big part of elixir
+# Due to immutability, recursion is a big part of Elixir
defmodule Recursion do
def sum_list([head | tail], acc) do
sum_list(tail, acc + head)
@@ -382,7 +381,7 @@ end
## ---------------------------
# Elixir relies on the actor model for concurrency. All we need to write
-# concurrent programs in elixir are three primitives: spawning processes,
+# concurrent programs in Elixir are three primitives: spawning processes,
# sending messages and receiving messages.
# To start a new process we use the `spawn` function, which takes a function
@@ -439,7 +438,7 @@ self() #=> #PID<0.27.0>
# Create an agent with `Agent.start_link`, passing in a function
# The initial state of the agent will be whatever that function returns
-{ok, my_agent} = Agent.start_link(fn -> ["red", "green"] end)
+{:ok, my_agent} = Agent.start_link(fn -> ["red", "green"] end)
# `Agent.get` takes an agent name and a `fn` that gets passed the current state
# Whatever that `fn` returns is what you'll get back
@@ -451,9 +450,10 @@ Agent.update(my_agent, fn colors -> ["blue" | colors] end)
## References
-* [Getting started guide](http://elixir-lang.org/getting-started/introduction.html) from the [Elixir website](http://elixir-lang.org)
+* [Getting started guide](https://elixir-lang.org/getting-started/introduction.html) from the [Elixir website](https://elixir-lang.org)
* [Elixir Documentation](https://elixir-lang.org/docs.html)
* ["Programming Elixir"](https://pragprog.com/book/elixir/programming-elixir) by Dave Thomas
-* [Elixir Cheat Sheet](http://media.pragprog.com/titles/elixir/ElixirCheat.pdf)
-* ["Learn You Some Erlang for Great Good!"](http://learnyousomeerlang.com/) by Fred Hebert
+* [Elixir Cheat Sheet](https://media.pragprog.com/titles/elixir/ElixirCheat.pdf)
+* ["Learn You Some Erlang for Great Good!"](https://learnyousomeerlang.com/) by Fred Hebert
* ["Programming Erlang: Software for a Concurrent World"](https://pragprog.com/book/jaerlang2/programming-erlang) by Joe Armstrong
+* [Introduction to Elixir](https://learn-elixir.com/)