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
| % Compile: c(gs_frequency). | |
| -module(gs_frequency). | |
| -author("William Vargas"). | |
| -version("1.0"). | |
| -behaviour(gen_server). | |
| % API | |
| -export([start_link/0, get/0, add/1, allocate/0, deallocate/1, reset/0, stop/0]). | |
| % gen_server |
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
| % Compile: c(frequency). | |
| -module(frequency). | |
| -author("William Vargas"). | |
| -version("1.0"). | |
| -export([init/2, start/2]). | |
| % Register the server as frequency_hardened | |
| -spec start(atom(), list(integer())) -> pid(). | |
| start(Process, Frequencies) -> |
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
| AL-COL-15761:hot code upgrade williamvargas$ erl | |
| Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] | |
| Eshell V9.1 (abort with ^G) | |
| 1> | |
| 1>%% Copy the frequency1.erl to frequency.erl | |
| 1> os:cmd("cp frequency1.erl frequency.erl"). | |
| [] | |
| 2> %% Compile the frenquency module | |
| 2> c(frequency). |
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
| % Compile: c(frequency_hardened). | |
| -module(frequency_hardened). | |
| -author("William Vargas"). | |
| -version("1.0"). | |
| -export([init/0, start/0, stop/0, allocate/0, deallocate/1, tests/0]). | |
| % Register the server as frequency_hardened | |
| -spec start() -> ?MODULE. | |
| start() -> |
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
| % Compile: c(echo). | |
| -module(echo). | |
| -export([listener/0]). | |
| -author("William Vargas"). | |
| -version("1.0"). | |
| -spec listener() -> any(). | |
| listener() -> | |
| case rand:uniform(10) of |
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
| % Compile: c(frequency_hardened). | |
| -module(frequency_hardened). | |
| -author("William Vargas"). | |
| -version("1.0"). | |
| -export([init/0, start/0, stop/0, allocate/0, deallocate/1, tests/0]). | |
| % Register the server as frequency_hardened | |
| -spec start() -> ?MODULE. | |
| start() -> |
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
| % Compile: c(frequency). | |
| -module(frequency). | |
| -author("William Vargas"). | |
| -version("1.0"). | |
| -export([init/0, start/0, allocate/0, deallocate/1, tests/0]). | |
| % Register the server as frequency | |
| -spec start() -> frequency. |
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
| % Compile: c(mailbox). | |
| -module(mailbox). | |
| -author("William Vargas"). | |
| -version("1.0"). | |
| -export([receiver/0, receiver_seq/0, tests/0]). | |
| receiver() -> | |
| timer:sleep(1000), | |
| receive |
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
| % Compile: c(palin). | |
| % Start the server: Server = spawn(palin,server,[self()]). | |
| % Display the messages in the terminal: flush(). | |
| -module(palin). | |
| -author("William Vargas"). | |
| -version("1.0"). | |
| -export([tests/0, check/1, server/1]). | |
| -spec remove_punctuation(string()) -> list(string()). |
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
| % Compile: | |
| % c(rpss). | |
| -module(rpss). | |
| -author("William Vargas"). | |
| -version("1.0"). | |
| -export([ | |
| play/1, | |
| echo/1, | |
| play_two/3, | |
| rock/1, |
NewerOlder