[erlang-questions] stuck at a exercise

Roelof Wobben r.wobben@REDACTED
Mon Jan 26 15:09:19 CET 2015


Hello,

At a book im following with self-study I have to do 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 I tried the first clause and came with this :

-module(boolean).

-export([boolean/1]).

b_not({true}) ->
   false.

But as soon as I compile it I see these error messages :

boolean.erl:3: function boolean/1 undefined
boolean.erl:5: Warning: function b_not/1 is unused

How to solve these ?

Roelof






More information about the erlang-questions mailing list