This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(jaime). | |
-behaviour(gen_server). | |
-export([ start/0 | |
, carry/1 | |
, deliver/0 | |
, trip/0 | |
]). | |
-export([ init/1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… | |
do_run(Options) -> | |
Warnings = dialyzer:run(Options), | |
Msg = [dialyzer:format_warning(Warning, basename) || Warning <- Warnings], | |
io:format("~s", [Msg]). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(dia). | |
-export([run/1, plt/0]). | |
-spec plt() -> ok. | |
plt() -> | |
Options = | |
[ {analysis_type, 'plt_build'} | |
, {get_warnings, true} | |
, {output_plt, "dia.plt"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ iex -S mix | |
Erlang/OTP 19 [erts-8.0] [source-6dc93c1] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] | |
Compiling 1 file (.ex) | |
== Compilation error on file lib/wat.ex == | |
** (SyntaxError) lib/wat.ex:9: syntax error before: ',' | |
(elixir) lib/kernel/parallel_compiler.ex:116: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-spec count(country(), [group()]) -> non_neg_integer(). | |
count(Country, Groups) -> | |
lists:sum( | |
lists:map( | |
fun (#{country := C, members := Members}) when C == Country -> | |
length(Members); | |
(_) -> | |
0 | |
end, Groups)). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-spec count(country(), [group()]) -> non_neg_integer(). | |
count(Country, Groups) -> | |
lists:sum( | |
[ length(Members) | |
|| #{country := Country, members := Members} <- Groups | |
]). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-spec count(country(), [group()]) -> non_neg_integer(). | |
count(Country, Groups) -> | |
lists:sum( | |
lists:map( | |
fun (#{country := Country, members := Members}) -> | |
length(Members); | |
(_) -> | |
0 | |
end, Groups)). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(people). | |
-export([count/2]). | |
-export([test/0]). | |
-type user() :: binary(). | |
-type country() :: atom(). | |
-type group() :: #{ country => country() | |
, members => [user()] | |
}. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(hello). | |
-export([world/0, f/0, '-f/0-fun-0-'/0]). | |
world() -> | |
F = f(), | |
F = f(), | |
io:format("~s~n", [F()]). | |
f() -> fun() -> "Hello, world!" end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(hello). | |
-export([world/0, f/0]). | |
world() -> | |
F = f(), | |
F = f(), | |
io:format("~s~n", [F()]). | |
f() -> fun() -> "Hello, world!" end. |