writing a simple function
Matthias.Lang@REDACTED
Matthias.Lang@REDACTED
Mon Sep 11 15:38:58 CEST 2000
Hi,
It sounds like doing the online course would help. You can find it,
and some other suggestions, at
http://www.erlang.org/starting.html
Matthias
------------------------------
To directly answer your question, here's a program which prints
'hello' 1000 times by calling the 'fwrite' function in the module
'hello' 1000 times, after importing it:
-module(time).
-export([go/0]).
-import(io, [fwrite/1]).
go() ->
Start = time(),
loop(1000),
{Start, time()}.
loop(0) ->
done;
loop(N) ->
fwrite("hello"),
loop(N-1).
It returns the start and finish times. On my machine they differ by
about a second.
> I'm new to erlang programming, and I'm trying to work out how to write a
> programme that Erlang can Compile that imports a function from another
> module, and iterates that function, say, 1000 times. (For timer purposes, so
> I can work out how long it is taking).
>
> What would the basic template be? (ie what do for loops look like, how is a
> function imported/exported, how are variables initialized etc.)
>
> nagi
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
> Share information about yourself, create your own public profile at
> http://profiles.msn.com.
>
More information about the erlang-questions
mailing list