writing a simple function

Matthias.Lang <>
Mon Sep 11 15:38:58 CEST 2000


It sounds like doing the online course would help. You can find it,
and some other suggestions, at




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:

	-import(io, [fwrite/1]).
	go() ->
	        Start = time(),
	        {Start, time()}.
	loop(0) ->
	loop(N) ->

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