Exercises
Read:
The Enumerable protocol (https://github.com/elixir-lang/elixir/blob/v1.0.5/lib/elixir/lib/enum.ex) in the Elixir source
The typespec documentation (http://elixir-lang.org/docs/stable/elixir/#!Kernel.Typespec.html)
Do:
Write your own
unless
macro. You may use either yourif
from the chapter or the standard libraryif
:Does using the standard library,
if
, produce a deeper AST than usingcase
directly?
Write your own
while
macro:Use the test
WhileTest
module to make sure it functions correctly.Add a test case for a
break
statement. (Hint: It will look similar to the test case provided.) Now addbreak
to your macro.