<div dir="ltr">Hi,<div><br></div><div>You don't have any functions named square, circle or triangle. You have only one function array/1 with four function clauses, the first for square, the second for circle, the third for triangle and the fourth catch-all one.</div><div><br></div><div>Hynek</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 25, 2015 at 12:29 PM, Roelof Wobben <span dir="ltr"><<a 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">Thanks,<br>
<br>
That error messages disappear.<br>
<br>
As I understand it right. The eror message is on all functions so on the square, circle and triangle functions.<br>
And if not so, why also not a error functions on the other two.<br>
<br>
Roelof<br>
<br>
<br>
<br>
<br>
Taavi Talvik schreef op 25-1-2015 om 12:22:<div class="HOEnZb"><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Until you export your functions, they remain local to<br>
module. And compiler sees here, that they are not used<br>
locally here.<br>
<br>
Try adding<br>
-export([area/1]).<br>
<br>
best regards,<br>
taavi<br>
On 25 Jan 2015, at 13:12, Roelof Wobben <<a href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
I have this programm :<br>
<br>
-module(shapes).<br>
<br>
-import(math, [sqrt/1]).<br>
<br>
area({square, Side}) -><br>
Side * Side ;<br>
<br>
area({circle, Radius}) -><br>
math:pi() * Radius * Radius;<br>
<br>
area({triangle, A, B, C}) -><br>
S = (A + B + C)/2,<br>
math:sqrt(S*(S-A)*(S-B)*(S-C))<u></u>;<br>
<br>
area(Other) -><br>
{error, invalid_object}.<br>
<br>
<br>
As soon I as try to compile it , I see these messages :<br>
<br>
<br>
6> c(shapes).<br>
shapes.erl:5: Warning: function area/1 is unused<br>
shapes.erl:15: Warning: variable 'Other' is unused<br>
<br>
Why does Erlang do this?<br>
On compile time you cannot see which functions are used and which not in my oponion.<br>
<br>
Roelof<br>
<br>
<br>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
</blockquote>
<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>