Skip to content

Instantly share code, notes, and snippets.

View elbrujohalcon's full-sized avatar
🇪🇸
Working from Catalunya

Brujo Benavides elbrujohalcon

🇪🇸
Working from Catalunya
View GitHub Profile
@elbrujohalcon
elbrujohalcon / my_lists.erl
Created November 27, 2017 01:52
for my blog
-module my_lists.
%% seq(Min, Max) -> [Min,Min+1, ..., Max]
%% seq(Min, Max, Incr) -> [Min,Min+Incr, ..., Max]
%% returns the sequence Min..Max
%% Min <= Max and Min and Max must be integers
-export [seq/2, seq/3].
-spec seq(From, To) -> Seq when
From :: integer(),
@elbrujohalcon
elbrujohalcon / my_lists.erl
Created November 23, 2017 16:29
lists:seq/2,3
-module(my_lists).
-export([seq/2, seq/3]).
%% seq(Min, Max) -> [Min,Min+1, ..., Max]
%% seq(Min, Max, Incr) -> [Min,Min+Incr, ..., Max]
%% returns the sequence Min..Max
%% Min <= Max and Min and Max must be integers
-spec seq(From, To) -> Seq when
1> code:load_file(sendmail).
=ERROR REPORT==== 10-Nov-2017::09:05:01 ===
…/beam/sendmail.beam failed: badfile
=ERROR REPORT==== 10-Nov-2017::09:05:01 ===
beam/beam_load.c(1159): Error loading module sendmail:
not a BEAM file: no IFF 'FOR1' chunk
{error,badfile}
-module(x).
-export([bad/1]).
bad(A) ->
B = case rand:uniform() of
C when C < 0.5 -> C;
D when D >= 0.5 -> 1 - D
end,
A + B - C.
-module(x).
-export([bad/1]).
bad(A) ->
B = case rand:uniform() of
C when C < 0.5 -> C;
D when D >= 0.5 -> 1 - D
end,
A + B.
-module(x).
-export([c/0, d/0, e/1]).
c() -> [x || id(nothing)].
d() -> [x || nothing].
e(X) -> [x || X].
id(X) -> X.
module 'x' ['c'/0,
'd'/0,
'e'/1,
'module_info'/0,
'module_info'/1]
attributes [%% Line 1
'file' =
%% Line 1
[{[115|[114|[99|[47|[120|[46|[101|[114|[108]]]]]]]]],1}]]
'c'/0 =
-module(x).
-export([c/0, d/0]).
c() -> [x || id(nothing)].
d() -> [x || nothing].
id(X) -> X.
@elbrujohalcon
elbrujohalcon / x.erl
Created October 29, 2017 14:48
for my blog
-module(x).
-export([x/0, y/0]).
id(X) -> X.
y() -> [x || id(nothing)].
x() ->
Id = fun(X) -> X end,
[x || Id(nothing)].
@elbrujohalcon
elbrujohalcon / base_server.erl
Created October 7, 2017 20:11
Examples for my Blog
-module(base_server).
-type state() :: #{_ => _}.
-export([handle_info/2]).
-spec handle_info(term(), state()) -> {noreply, state()}.
handle_info(Msg, State) ->
error_logger:warning_msg("Unexpected Message: ~p", [Msg]),
{noreply, State}.