"function password_generator/0 undefined" <--- Having a n00b moment.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

"function password_generator/0 undefined" <--- Having a n00b moment.

Yves S. Garret-2
I'm trying to get back into Erlang and figured I'd try this example, just
for my own amusement and scant benefit.

This is my code and -- frankly -- I don't understand why I'm getting this
error.
http://bin.cakephp.org/view/439045988

Why am I getting this error?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120328/a74cd5cb/attachment.html>

Reply | Threaded
Open this post in threaded view
|

"function password_generator/0 undefined" <--- Having a n00b moment.

André Graf
Hello

The two password_generator functions are of different arity (0 and 5),
so you cannot terminate the arity 0 function with the semicolon. Use
the dot instead.

Cheers
Andre

On 28 March 2012 20:48, Yves S. Garret <yoursurrogategod> wrote:

> I'm trying to get back into Erlang and figured I'd try this example, just
> for my own amusement and scant benefit.
>
> This is my code and -- frankly -- I don't understand why I'm getting this
> error.
> http://bin.cakephp.org/view/439045988
>
> Why am I getting this error?
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions
>


Reply | Threaded
Open this post in threaded view
|

"function password_generator/0 undefined" <--- Having a n00b moment.

Gleb Peregud-2
In reply to this post by Yves S. Garret-2
On Wed, Mar 28, 2012 at 20:48, Yves S. Garret
<yoursurrogategod> wrote:
> I'm trying to get back into Erlang and figured I'd try this example, just
> for my own amusement and scant benefit.

Take a look at a semicolon at the end of the first clause. There
should be a dot instead


Reply | Threaded
Open this post in threaded view
|

"function password_generator/0 undefined" <--- Having a n00b moment.

Yves S. Garret-2
I thought that one of the things that I can do with methods in Erlang is
use the ';' in order to  cycle through a number of different input types
for methods.

I think I might have forgotten some parts of this works :-) .

*starts digging up his Erlang book*

On Wed, Mar 28, 2012 at 2:54 PM, Gleb Peregud <gleber.p> wrote:

> On Wed, Mar 28, 2012 at 20:48, Yves S. Garret
> <yoursurrogategod> wrote:
> > I'm trying to get back into Erlang and figured I'd try this example, just
> > for my own amusement and scant benefit.
>
> Take a look at a semicolon at the end of the first clause. There
> should be a dot instead
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120328/b901b381/attachment.html>

Reply | Threaded
Open this post in threaded view
|

"function password_generator/0 undefined" <--- Having a n00b moment.

Samuel Elliott
On Wed, Mar 28, 2012 at 9:15 PM, Yves S. Garret
<yoursurrogategod> wrote:
> I thought that one of the things that I can do with methods in Erlang is use
> the ';' in order to? cycle through a number of different input types for
> methods.

You're correct, however two functions are different functions if their
arity is different.

You'd use a semicolon between the different inputs to foo/2, but
that's a completely different function to foo/1 so you use a dot
between the two functions themselves.

I hope that's clear, if it's not, I'm sure someone else on the list
will have a far clearer explanation than I can manage.

Sam

>
> I think I might have forgotten some parts of this works :-) .
>
> *starts digging up his Erlang book*
>
>
> On Wed, Mar 28, 2012 at 2:54 PM, Gleb Peregud <gleber.p> wrote:
>>
>> On Wed, Mar 28, 2012 at 20:48, Yves S. Garret
>> <yoursurrogategod> wrote:
>> > I'm trying to get back into Erlang and figured I'd try this example,
>> > just
>> > for my own amusement and scant benefit.
>>
>> Take a look at a semicolon at the end of the first clause. There
>> should be a dot instead
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions
>



--
Samuel Elliott
sam
http://lenary.co.uk/
+44 (0)7891 993 664