[erlang-questions] Programming a recursive function that executes n times

Allan Wegan <>
Thu Oct 21 18:22:30 CEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> I want to simulate a time consuming task on Erlang, let's say I want
to execute 10 000 times the above line:
>
> test_mnesia:busqueda(cars).
>
> How can I accomplish this on Erlang?

Try:
fun test() ->
Test_fun = fun (F, 0) -> 'undefined'; (F, N) ->
test_mnesia:busqueda(cars), F(F, N - 1) end,
Test_fun(Test_fun, 10000)
.

- -- 
Allan Wegan
Jabber: 
ICQ:    209459114
Phone:  +49 40 6732962
Schöneberger Straße 60, 22149 Hamburg

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (MingW32)

iQEcBAEBAgAGBQJMwGjGAAoJENm5axHh7AcxkQ4IALfcClXsAdPZXos3cEHDgVCB
SOtjB9evtY8FSTC/yx0d3iHcyD2qIDUWv0ekqNEBr9MR21KS5eT6NxusHZTS+xk6
yZXpW9ja9nOAiDkjjvLBVBx6O3V+0JZ2Xgx1L1UuXjq0LfBbpbTUgbIBOODk7Z01
oDyv7wTo/igjxhrMcHSMAlGIoXAEmAzPanfq3zKxJXQPYRYvc7Uh5MMZAQp8F62f
+MMGUYCnlGonXA4rSTWCF6lathY+r/DfLgcehJu4GDxAM9q6k1yVVzLQTCUahKY6
D26oWvisWZoqUR8VANiW9xdZuYKPFee6PIRatRITnUVEass5gyQbUKRJCppBE4Q=
=o1Lg
-----END PGP SIGNATURE-----


More information about the erlang-questions mailing list