Attempt clarifying the pin operator

This commit is contained in:
Uku Taht
2016-04-26 12:57:42 +01:00
parent 2aeccdd8f7
commit 353ce95a1a
2 changed files with 6 additions and 4 deletions

View File

@@ -8,12 +8,14 @@ defmodule PatternMatching do
koan "A pattern can change" do koan "A pattern can change" do
a = 1 a = 1
a = 2 a = 2
assert (a == 2) == ___ assert a == ___
end end
koan "A pattern can also be strict" do koan "A pattern can also be strict" do
a = 1 a = 1
assert ^a = ___ assert_raise ___, fn() ->
^a = 2
end
end end
koan "Patterns can be used to pull things apart" do koan "Patterns can be used to pull things apart" do

View File

@@ -5,8 +5,8 @@ defmodule PatternsTests do
test "Pattern Matching" do test "Pattern Matching" do
answers = [ answers = [
1, 1,
true, 2,
1, MatchError,
{:multiple, [1, [2,3,4]]}, {:multiple, [1, [2,3,4]]},
[1,2,3,4], [1,2,3,4],
3, 3,