Skip to content

Instantly share code, notes, and snippets.

View abdulmuhaimin-work's full-sized avatar
🏠
learning

Abdul Muhaimin abdulmuhaimin-work

🏠
learning
  • Malaysia
View GitHub Profile
@abdulmuhaimin-work
abdulmuhaimin-work / eleventh.erl
Last active March 22, 2017 02:52
Modelling the basics of rock-paper-scissors. A task for Functional programming in Erlang course.
-module(eleventh).
-export([beat/1, lose/1, result/2, tournament/2]).
beat(rock) -> paper;
beat(paper) -> scissor;
beat(scissor) -> rock;
beat(_) -> "invalide move".
lose(rock) -> scissor;
lose(scissor) -> paper;
@abdulmuhaimin-work
abdulmuhaimin-work / tenth.erl
Last active March 21, 2017 11:53
Higher-order functions in practice. A task from the Functional Programming in Erlang course.
-module(tenth).
-export([doubleAll/1, even/1, product/1, zip/2, zip_with/3, zip_with_new/3, zip_new/2]).
% doubleAll, evens, and product
% doubleAll([]) -> [];
% doubleAll([X|Xs]) ->
% [ 2*X | doubleAll(Xs) ].
doubleAll(X) ->
@abdulmuhaimin-work
abdulmuhaimin-work / challenge.erl
Last active March 19, 2017 18:37
Programming challenge: indexing a file. An assignement for Functional Programming in Erlang course in Futurelearn
-module(challenge).
-export([onLine/2]).
onLine(Word, Name) ->
{ok, File} = file:open(Name,[read]),
LowerWord = string:to_lower(Word),
Rev = get_all_lines(LowerWord,File,[],1),
lists:reverse(Rev).
get_all_lines(Word,File,Partial,Line) ->

Keybase proof

I hereby claim:

  • I am abdulmuhaimin-work on github.
  • I am abdulmuhaimin (https://keybase.io/abdulmuhaimin) on keybase.
  • I have a public key whose fingerprint is D83D AA3D F080 FEBF 685B 770D FA3C 6860 0E7A 0A57

To claim this, I am signing this object: