<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Yes, you can do:<br>
<br>
b_nand(X,Y) -> <br>
b_not(b_and(X,Y)).<br>
<br>
Ivan<br>
<br>
<br>
<div class="moz-cite-prefix">On 26/01/2015 17:01, Roelof Wobben
wrote:<br>
</div>
<blockquote cite="mid:54C672F6.6020304@home.nl" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
============================================================
Ivan A. Uemlianin PhD
Llaisdy
Speech Technology Research and Development
<a class="moz-txt-link-abbreviated" href="mailto:ivan@llaisdy.com">ivan@llaisdy.com</a>
@llaisdy
llaisdy.wordpress.com
github.com/llaisdy
<a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/ivanuemlianin">www.linkedin.com/in/ivanuemlianin</a>
festina lente
============================================================ </pre>
</body>
</html>