<div dir="ltr">The argument is a tuple. Erlang does not have arrays; you have to decide whether to use a list or a tuple.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 26, 2015 at 12:36 AM, 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">
<div bgcolor="#FFFFFF" text="#000000">
<div>Nope, Thanks for the patience with me.<br>
<br>
So area is the function with 1 argument a array with the shape and
the parameters to calculate it.<br>
<br>
Roelof<br>
<br>
<br>
<br>
Hynek Vychodil schreef op 25-1-2015 om 14:23:<br>
</div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">Sorry, typo I mean area/1 and arity 1 because you
have only one parameter.</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sun, Jan 25, 2015 at 1:24 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">
<div bgcolor="#FFFFFF" text="#000000">
<div>Sorry, now im totally confused .<br>
<br>
where does the name array come from and why a arity 1 ?<br>
<br>
Roelof<br>
<br>
<br>
Hynek Vychodil schreef op 25-1-2015 om 13:07:<br>
</div>
<div>
<div>
<blockquote type="cite">
<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>
<div><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));<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>
_______________________________________________<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/listinfo/erlang-questions</a><br>
</blockquote>
<br>
</blockquote>
<br>
_______________________________________________<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/listinfo/erlang-questions</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<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/listinfo/erlang-questions</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</div></div></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Christopher Vance</div>
</div>