Skip to content

Instantly share code, notes, and snippets.

@yosangwon
Created July 2, 2017 09:01
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 yosangwon/b1478c5d3bdc2e1aeff5e606e71d7fa2 to your computer and use it in GitHub Desktop.
Save yosangwon/b1478c5d3bdc2e1aeff5e606e71d7fa2 to your computer and use it in GitHub Desktop.
1.15
-module(third).
-export([x0r1/2, x0r2/2, x0r3/2, maxThree/3, howManyEqual/3]).
x0r1(A,B) ->
A =/= B.
x0r2(A,B) ->
not (A == B).
x0r3(A,B) ->
((not A and B) or (A and not B)).
maxThree(X,Y,Z) ->
max(max(X,Y),Z).
howManyEqual(X,X,X) -> 3;
% if the last argument was same, that should matched above.
howManyEqual(X,X,_) -> 2;
howManyEqual(X,_,X) -> 2;
howManyEqual(_,X,X) -> 2;
howManyEqual(_,_,_) -> 0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment