2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -0,0 +1 @@
ret = {:ok, "fun", 3.1415}

View file

@ -0,0 +1,4 @@
elem(ret, 1) == "fun"
elem(ret, 0) == :ok
put_elem(ret, 2, "pi") # => {:ok, "fun", "pi"}
ret == {:ok, "fun", 3.1415}

View file

@ -0,0 +1 @@
Tuple.append(ret, 3.1415) # => {:ok, "fun", "pie", 3.1415}

View file

@ -0,0 +1 @@
Tuple.insert_at(ret, 1, "new stuff") # => {:ok, "new stuff", "fun", "pie"}

View file

@ -0,0 +1 @@
[ 1, 2, 3 ]

View file

@ -0,0 +1,8 @@
my_list = [1, :two, "three"]
my_list ++ [4, :five] # => [1, :two, "three", 4, :five]
List.insert_at(my_list, 0, :cool) # => [:cool, 1, :two, "three"]
List.replace_at(my_list, 1, :cool) # => [1, :cool, "three"]
List.delete(my_list, :two) # => [1, "three"]
my_list -- ["three", 1] # => [:two]
my_list # => [1, :two, "three"]

View file

@ -0,0 +1,10 @@
iex(1)> fruit = [:apple, :banana, :cherry]
[:apple, :banana, :cherry]
iex(2)> hd(fruit)
:apple
iex(3)> tl(fruit)
[:banana, :cherry]
iex(4)> hd(fruit) == :apple
true
iex(5)> tl(fruit) == [:banana, :cherry]
true