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
-module joe.
-export [test/0, perms/1].
test() ->
[[]] = joe:perms(""),
["a"] = joe:perms("a"),
["ab", "ba"] = joe:perms("ab"),
["ba", "ab"] = joe:perms("ba"),
["123","132","213","231","312","321"] = joe:perms("123"),
-module joe.
-export [test/0, perms/1].
test() ->
[[]] = joe:perms(""),
["a"] = joe:perms("a"),
["ab", "ba"] = joe:perms("ab"),
["ba", "ab"] = joe:perms("ba"),
["123","132","213","231","312","321"] = joe:perms("123"),
-module joe.
-export [test/0].
test() ->
[[]] = joe:perms(""),
["a"] = joe:perms("a"),
["ab", "ba"] = joe:perms("ab"),
["ba", "ab"] = joe:perms("ba"),
["123","132","213","231","312","321"] = joe:perms("123"),
@elbrujohalcon
elbrujohalcon / my_modules.ex
Last active June 18, 2019 04:33
My Modules
defmodule MyODT do
@opaque t() :: %{required(:f1) => boolean, required(:f2) => atom}
@spec new(boolean, atom) :: t
def new(f1, f2), do: %{f1: f1, f2: f2}
@spec f1(t) :: boolean
def f1(%{f1: f1}), do: f1
def f2(%{f2: f2}), do: f2
@elbrujohalcon
elbrujohalcon / my.file
Created November 25, 2018 21:40
Just a file
This is just a file.
1> A = [ [1,2,3],[4,5,6]].
[[1,2,3],[4,5,6]]
2> B = [ [a,b,c],[d,e,f]].
[[a,b,c],[d,e,f]]
3> [lists:zip(X, Y)|| X <- A, Y <- B].
[[{1,a},{2,b},{3,c}],
[{1,d},{2,e},{3,f}],
[{4,a},{5,b},{6,c}],
[{4,d},{5,e},{6,f}]]
@elbrujohalcon
elbrujohalcon / crazy_shorties.erl
Last active May 7, 2019 14:19
Esos Locos Bajitos (by Joan Manuel Serrat)
-module crazy_shorties.
-author(joan_manuel).
-export [new/0, teach/1, direct/1].
new() ->
Child = spawn_link(fun live/0),
timer:send_interval(1000, Child, tick),
Child.
@elbrujohalcon
elbrujohalcon / in.erl
Last active April 10, 2018 03:19
In My Life (by The Beatles)
-module(in).
-author(john).
-author(paul).
-author(george).
-author(ringo).
-export([my_life/1]).
my_life(NewPlaces) ->
-module(plusplus).
-export([first/0, second/0, third/0]).
-spec first() -> 'something'.
first() -> [] ++ something.
-spec second() -> none().
second() -> something ++ [].
-module(plusplus).
-export([first/0, second/0]).
first() -> [] ++ something.
second() -> something ++ [].