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
| %%% @doc frequency server step one | |
| %%% allocate limited frequencies to mobile phone users. | |
| %%% Server version 0 | |
| %%% Module 1.13 - modifying the frequency server. | |
| -module(frequency1). | |
| -export([start/0, init/0]). | |
| %% to start..... | |
| %% Freq = spawn(frequency, init, []). |
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
| %%% @doc mailbox processing. | |
| -module(mailbox). | |
| -export([tester/1, receiver1/0, receiver2/0, tester2/1, receiver3/0]). | |
| %%% @doc a function to test receiver processes, send 4 messages | |
| %%% in quick succession. | |
| tester(Pid) -> | |
| Pid ! one, | |
| Pid ! two, |
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
| %%% @doc Palindrome server | |
| %%% Part1 of exercise | |
| -module(palin). | |
| -export([server/1]). | |
| %% @doc the palindrome server. | |
| server(From) -> | |
| receive | |
| {check, Str} -> | |
| case palindrome_check(Str) 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
| -module(rps2). | |
| -export([play/1,echo/1,play_two/3,val/1,tournament/2]). | |
| %% strategies | |
| -export([rock/1, no_repeat/1, const/1, paper/1, rand/1, scissors/1, random_choice/1]). | |
| -include_lib("eunit/include/eunit.hrl"). | |
| %% data specs |
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(rps2). | |
| -export([play/1,echo/1,play_two/3,val/1,tournament/2]). | |
| %% strategies | |
| -export([rock/1, no_repeat/1, const/1, paper/1, rand/1, scissors/1, random_choice/1]). | |
| -include_lib("eunit/include/eunit.hrl"). | |
| %% data specs |
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
| %% Funtions as results homework - 3.11 | |
| -module(partial). | |
| -export([comp/2, | |
| comp_all_r/1, comp_all/1, | |
| twice/1, quad/1, | |
| iteration/2]). | |
| -include_lib("eunit/include/eunit.hrl"). |
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
| %% Modeling a rock paper scissors tournament -- 3.8 | |
| -module(rps). | |
| -export([beat/1, lose/1, result/2, score/1, tournament/2]). | |
| -include_lib("eunit/include/eunit.hrl"). | |
| -type rps() :: rock | paper | scissors | error. | |
| -type result() :: win | lose | draw. |
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
| %% higher-order function practice -- 3.5 | |
| -module(practice). | |
| -export([doubleAll/1, evens/1, product/1, zip/2]). | |
| -export([doubleAll_h/1, evens_h/1, product_h/1]). | |
| -export([zip_with/3, zip_with2/3, zip2/2]). | |
| -include_lib("eunit/include/eunit.hrl"). | |
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
| %% market project - 2.25 | |
| -module(market). | |
| -include_lib("eunit/include/eunit.hrl"). | |
| -export([return_db/0, return_sales/0, find_product/2, sales_list/2, | |
| count_sherries/1, print_bill/1, run/0]). | |
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| %% To run the demo: |
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(index). | |
| -export([get_file_contents/1,show_file_contents/1]). | |
| -export([index_file/1,print_index/1]). | |
| -export([partition_test/0]). | |
| %% The main prorgram. | |
| %% Run: | |
| %% index:index_file("gettysburg-address.txt"). | |
| %% to produce a list of word indexes. |
NewerOlder