[erlang-questions] question about erlang doc

10 views
Skip to first unread message

Rustom Mody

unread,
Dec 16, 2012, 11:35:08 AM12/16/12
to Erlang Users' List
In http://www.erlang.org/doc/man/random.html I see this line:

seed(X1 :: {A1, A2, A3}) -> undefined | ran()

Whats the '::' ?
Also I cant figure out how to read what follows the '->'

Please note I am not so much interested in the specifics of random numbers as in being able to read the manual!

Jim

unread,
Dec 16, 2012, 11:51:08 AM12/16/12
to Rustom Mody, Erlang Users' List
I believe this is a type specification indicating that the function seed/1 takes a parameter X1 of type (that's what the :: means) 3-tuple ({A1, A2, A3}) and returns (indicated by the ->) undefined or a random number (whatever ran/0 indicates).

Notice that A1, A2, A3 are further specified to be integers in the lines below. 


Sent from my iPad
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Jeremy Ong

unread,
Dec 16, 2012, 2:12:50 PM12/16/12
to Rustom Mody, Erlang Users' List
See http://www.erlang.org/doc/reference_manual/typespec.html for more details. Think of the type specification as a sort of function prototype (coming from the C world).


Rustom Mody

unread,
Dec 16, 2012, 11:40:02 PM12/16/12
to Erlang Users' List
On Mon, Dec 17, 2012 at 12:42 AM, Jeremy Ong <jer...@playmesh.com> wrote:
See http://www.erlang.org/doc/reference_manual/typespec.html for more details. Think of the type specification as a sort of function prototype (coming from the C world).

Thanks Jeremy. I was looking for (something like) that.

Also thank you Jim.
Reply all
Reply to author
Forward
0 new messages