Skip to content

Instantly share code, notes, and snippets.

@AnwarShahriar
Created March 4, 2017 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnwarShahriar/d504b20e7470d3ce7fecce90acc7660d to your computer and use it in GitHub Desktop.
Save AnwarShahriar/d504b20e7470d3ce7fecce90acc7660d to your computer and use it in GitHub Desktop.
-module(practice).
-export([join/2, concat/1, member/2]).
join([],Y) -> Y;
join([X|Xs], [Y|Ys]) ->
[X|join(Xs, [Y|Ys])].
concat([X]) -> X;
concat([X|Xs]) ->
join(X, concat(Xs)).
member(X, [X|_Xs]) -> true;
member(_X, []) -> false;
member(X, [_Y|Ys]) -> member(X, Ys).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment