Skip to content

Instantly share code, notes, and snippets.

@Joakineee
Joakineee / index.erl
Created May 25, 2020 08:53
index file exercice
-module(index).
-export([get_file_contents/1,show_file_contents/1,index_words/1,test/0]).
% Used to read a file into a list of lines.
% Example files available in:
% gettysburg-address.txt (short)
% dickens-christmas.txt (long)
% Get the contents of a text file into a list of lines.
% Each line has its trailing newline removed.
@Joakineee
Joakineee / format.erl
Created May 27, 2020 08:43
text_processing exercise.
-module(format).
-export([text_processing/3]).
% Used to read a file into a list of lines.
% Example files available in:
% gettysburg-address.txt (short)
% dickens-christmas.txt (long)
% Get the contents of a text file into a list of lines.
% Each line has its trailing newline removed.
@Joakineee
Joakineee / rps.erl
Created June 11, 2020 13:09
rock papper scissor
-module(rps).
-export([tournament/2]).
beat(rock) -> paper;
beat(paper) -> scissors;
beat(scissors) -> rock.
result({X,X},Acc) -> Acc;
@Joakineee
Joakineee / palindrome.erl
Last active July 6, 2020 11:37
basic palindrome exercise
-module(palindrome).
-export([server/1]).
rem_punct(String) -> lists:filter(fun (Ch) ->
not(lists:member(Ch,"\"\'\t\n "))
end,
String).
@Joakineee
Joakineee / mailbox.erl
Created July 6, 2020 15:28
testing the mailbox
-module(mailbox).
-export([start/0,proccess/0,proccess2/0]).
start() ->
spawn(mailbox,proccess,[]).
proccess() ->
timer:sleep(3000),
receive
stop -> ok;