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
%%============================================================================== | |
%% Univ. Kent Functional Programing with Erlang | |
%% Week 3: Part 11 - Functions as results in practice | |
%% | |
%% Description: | |
%% consolidate understanding of functions that take functions as | |
%% arguments and return functions as results. | |
%% | |
%% Author: Brian L. Shaver | |
%% Date : 2017-03-25 |
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
%%============================================================================== | |
%% Univ. Kent Functional Programing with Erlang | |
%% Week 3: Part 5 - Higher-order functions in practice | |
%% | |
%% Description: | |
%% work with higher order functions 'map','filter', and 'reduce' | |
%% | |
%% Author: Brian L. Shaver | |
%% Date : 2017-03-22 | |
%%============================================================================== |
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
%%============================================================================== | |
%% Univ. Kent Functional Programing with Erlang | |
%% Week 2: Part 20 - indexing a file | |
%% | |
%% Description: | |
%% Use the main function main/1 to create your output. It will produce | |
%% a list of data structures: { "foo" , [{3,5},{7,7},{11,13}] } meaning | |
%% the word "foo" occurs on lines 3, 4, 5, 7, 11, 12 and 13 in the file. | |
%% | |
%% Enhancements: |
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
%%------------------------------------------------------------------------------ | |
%% Univ. Kent Functional Programing with Erlang | |
%% Week 2: Part 18 - Consolidation: functions over lists | |
%% | |
%% Description: | |
%% Optional exercises to help consolidate knowledge on defining functions | |
%% over lists | |
%% | |
%% Author: Brian L. Shaver | |
%% Date : 2017-03-12 |
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
%%------------------------------------------------------------------------------ | |
%% Univ. Kent Functional Programing with Erlang | |
%% Week 2: Part 9 - Constructing Functions on Lists | |
%% | |
%% Description: | |
%% Familiarize yourself with other ways of defining functions over lists | |
%% | |
%% Author: Brian L. Shaver | |
%% Date : 2017-03-10 | |
%%------------------------------------------------------------------------------ |
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
%%============================================================================== | |
%% Univ. Kent Functional Programing with Erlang | |
%% Week 2: Part 6 - Defining function over lists | |
%% | |
%% Description: | |
%% | |
%% Author: Brian L. Shaver | |
%% Date : 2017-03-04 | |
%%============================================================================== | |
-module(ex2_6). |
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(patterns). | |
-include_lib("eunit/include/eunit.hrl"). | |
-export([xOr1/2,xOr2/2,xOr3/2,maxThree/3,howManyEqual/3]). | |
xOr1(A,B) -> | |
(not (A and B)) and (A == not B). | |
% the first clause is necessary to ensure the function errors | |
% if given a non-boolean argument. | |
xOr1_test() -> |
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
#------------------------------------------------------------------------------- | |
# This module is meant to be included in the Base class of an STI model | |
# hierarchy. | |
# | |
# Heavily inspired by a couple key blog posts | |
# http://code.alexreisner.com/articles/single-table-inheritance-in-rails.html | |
# http://coderrr.wordpress.com/2008/04/22/building-the-right-class-with-sti-in-rails/#comment-1826 | |
# | |
# Thanks to Alex and coderrr! | |
#------------------------------------------------------------------------------- |