[erlang-questions] nand problem

Roelof Wobben r.wobben@REDACTED
Mon Jan 26 17:21:42 CET 2015


Hello,

I now have to make a nand boolean with pattern matching.
I have found out that nand is true except when its true and true.

as hint I get to implement nand using and and or.

Can someone give me a hint how to do this ?


My code looks like this at the moment :

-module(boolean).

-export([b_not/1, b_and/2, b_or/2]).

b_not(true) ->
   false;

b_not(false) ->
   true.

b_and(true, true) ->
   true;

b_and(true, false) ->
   false;

b_and(false, true) ->
   false;

b_and(false, false) ->
   false.


b_or(true, true) ->
   true;

b_or(true, false) ->
   true;

b_or(false, true) ->
   true;

b_or(false, false) ->
   false.


     Roelof




More information about the erlang-questions mailing list