[erlang-questions] second try for understanding recursion
Roelof Wobben
r.wobben@REDACTED
Sun Feb 8 10:48:11 CET 2015
Hello,
I have studied recursion the last few weeks by using Haskell and I think
I understand it.
I did a portion of this exercise :
Write a module boolean.erlthat takes logical expressions and Boolean
values (represented as the atoms trueand false) and returns their
Boolean result. The functions
you write should include b_not/1, b_and/2, b_or/2, and b_nand/2. You
should not use
the logical constructs and, or, and not, but instead use pattern
matching to achieve your
goal.
so far I have this :
-module(boolean).
-export([b_not/1]).
% if a empty string is given , the answer will be a empty string.
b_not('') ->
'';
% is false is given, the answer will be true.
b_not(false) ->
true;
% is true is given, the answer will be false
b_not(true) ->
false.
Is this a good try or can I change anything ?
Roelof
More information about the erlang-questions
mailing list