[erlang-questions] second try for understanding recursion

Tony Rogvall tony@REDACTED
Sun Feb 8 12:34:56 CET 2015


Deja vu?
I thought you already completed this exercise ?
Have you started reading the book I hinted about?

BR
/Tony

> On 8 feb 2015, at 10:48, Roelof Wobben <r.wobben@REDACTED> wrote:
> 
> 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
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150208/5ac16771/attachment.bin>


More information about the erlang-questions mailing list