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
import re | |
from random import * | |
used_words=[] | |
words=[] | |
animals=open('animals.txt','r') #opens file | |
for line in animals: # create list of animals |
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 (ass_wk1). | |
-export ([area/1, perimeter/1, enclose/1, bits/1, bits_tail/1]). | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
%% Question 1 - Shapes. %% | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% I'm assuming three shapes: circles, rectangles and squares. | |
%% Perimeter of circle is calulated using the standard formula 2 * Pi * R. |
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 (ass_wk1). | |
-export ([area/1, perimeter/1, enclose/1, bits/1, bits_tail/1]). | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
%% Question 1 - Shapes. %% | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% I'm assuming three shapes: circles, rectangles and squares. | |
%% Perimeter of circle is calulated using the standard formula 2 * Pi * R. |
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(morelists). | |
-export([concat/1, concat_test/0, insertion_sort/1, | |
join/2, join_test/0, member/2, member_test/0, | |
merge_sort/1, perms/1, perms_test/0, quicksort/1, | |
sort_tests/0]). | |
join([], Y) -> Y; | |
join([X | Xs], Y) -> [X | join(Xs, Y)]. |
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(lists2). | |
-export([join/2,concat/1,member/2,sort/1,sort/2,perms/1]). | |
-export([join_test/0,concat_test/0,member_test/0,sort_test/0,perms_test/0]). | |
%% Join %%% | |
join(L1, L2) when is_list(L1), is_list(L2) -> | |
join_internal(lists:reverse(L1), L2). | |
join_internal(L1, []) -> lists:reverse(L1); | |
join_internal(L1, [H|T]) -> |
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_index/1]). | |
% 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. |
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. |
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). | |
-compile([export_all]). | |
% -export([get_file_contents/1,show_file_contents/1]). | |
% Used to read a file into a list of lines. | |
% Example files available in: | |
% gettysburg-address.txt (short) | |
% dickens-christmas.txt (long) |
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). | |
-include_lib("eunit/include/eunit.hrl"). | |
-export([get_file_contents/1,show_file_contents/1,main/1]). | |
% Used to read a file into a list of lines. | |
% Example files available in: | |
% gettysburg-address.txt (short) | |
% dickens-christmas.txt (long) |
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, find_index/2]). | |
% 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. |
OlderNewer