Skip to content

Instantly share code, notes, and snippets.

Avatar

Abhishek C Sharma portgasd666

  • India
View GitHub Profile
View supervised_frequency.erl
-module(frequency).
-export([start/0, stop/0, allocate/0, deallocate/1, client/1]).
-export([init_supervisor/0, init_server/0]).
%% Server interface
% Start the supervisor and the frequency server
start() ->
register(frequency_supervisor, spawn(frequency, init_supervisor, [])).
@portgasd666
portgasd666 / frequency.erl
Created Apr 9, 2017
Frequency server that handles timeout and calls clear appropriately
View frequency.erl
%% Based on code from
%% Erlang Programming
%% Francecso Cesarini and Simon Thompson
%% O'Reilly, 2008
%% http://oreilly.com/catalog/9780596518189/
%% http://www.erlangprogramming.org/
%% (c) Francesco Cesarini and Simon Thompson
-module(frequency).
-export([start/0,allocate/0,deallocate/1,stop/0]).
@portgasd666
portgasd666 / index.erl
Created Mar 5, 2017
Functional Programming in Erlang MOOC: Programming Challenge - Indexing a File
View index.erl
-module(index).
-export([make_index/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)
make_index(Name) ->
get_word_index(get_all_annotated_words(get_file_contents(Name))).
You can’t perform that action at this time.