<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Yes. I have learned the wildcardpattern
but also there was a text beneath it saying not to use it for
defensive programming.<br>
<br>
oke I have misread it and have to use the not and and.<br>
<br>
Or can i do things like <br>
<br>
b_nand { true, true) -> <br>
b-not(b_and(true, true) <br>
<br>
Roelof<br>
<br>
<br>
<br>
Bob Ippolito schreef op 26-1-2015 om 17:27:<br>
</div>
<blockquote
cite="mid:CACwMPm8awD3A8gLbBkN=A5A8+z86KMi8h0fbL3586u=fUF33-Q@mail.gmail.com"
type="cite">
<div dir="ltr">Here's a hint:
<div><br>
</div>
<div><a moz-do-not-send="true"
href="http://en.wikipedia.org/wiki/NAND_gate">http://en.wikipedia.org/wiki/NAND_gate</a><br>
</div>
<div><br>
</div>
<div>You already have an inverter by another name.</div>
<div><br>
</div>
<div>Although in this case I think implementing NAND as a
pattern match would be quite simple. Have you learned about
wildcard patterns yet (the _ symbol)?</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Jan 26, 2015 at 8:21 AM, Roelof
Wobben <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I now have to make a nand boolean with pattern matching.<br>
I have found out that nand is true except when its true and
true.<br>
<br>
as hint I get to implement nand using and and or.<br>
<br>
Can someone give me a hint how to do this ?<br>
<br>
<br>
My code looks like this at the moment :<br>
<br>
-module(boolean).<br>
<br>
-export([b_not/1, b_and/2, b_or/2]).<br>
<br>
b_not(true) -><br>
false;<br>
<br>
b_not(false) -><br>
true.<br>
<br>
b_and(true, true) -><br>
true;<br>
<br>
b_and(true, false) -><br>
false;<br>
<br>
b_and(false, true) -><br>
false;<br>
<br>
b_and(false, false) -><br>
false.<br>
<br>
<br>
b_or(true, true) -><br>
true;<br>
<br>
b_or(true, false) -><br>
true;<br>
<br>
b_or(false, true) -><br>
true;<br>
<br>
b_or(false, false) -><br>
false.<br>
<br>
<br>
Roelof<br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a moz-do-not-send="true"
href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a moz-do-not-send="true"
href="http://erlang.org/mailman/listinfo/erlang-questions"
target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>