Merge pull request #40 from ukutaht/add-pin-and-pipe-operators-koans
WIP Feedback
This commit is contained in:
@@ -92,4 +92,13 @@ defmodule Functions do
|
||||
koan "You can 'capture' functions if you want to pass them around as values" do
|
||||
assert multiply_then_call(2, &square/1) == 100
|
||||
end
|
||||
|
||||
koan "functions can be combined elegantly with the pipe operator" do
|
||||
result = "full-name"
|
||||
|> String.split("-")
|
||||
|> Enum.map(&(String.capitalize(&1)))
|
||||
|> Enum.join(" ")
|
||||
|
||||
assert result == "Full Name"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,6 +5,16 @@ defmodule PatternMatching do
|
||||
assert match?(1, 1)
|
||||
end
|
||||
|
||||
koan "a pattern can change" do
|
||||
a = 1
|
||||
assert a = 2
|
||||
end
|
||||
|
||||
koan "a pattern can also be strict" do
|
||||
a = 1
|
||||
assert ^a = 2
|
||||
end
|
||||
|
||||
koan "patterns can be used to pull things apart" do
|
||||
[head | tail] = [1,2,3,4]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user