I must be stupid

Joel Reymont joelr1@REDACTED
Sat Jul 9 20:31:55 CEST 2005


Could you please tell me what's wrong with my code below? I'm using  
10RB6 on Mac OSX 10.4.1.

-module(tuple).

-compile([export_all]).

test1(N) ->
     populate1([], N).

populate1(Acc, 0) ->
     Acc;

populate1(Acc, Size) ->
     Acc1 = [Size|Acc],
     populate1(Acc1, Size - 1).

What I get:

2> hipe:c(tuple).
{ok,tuple}
3>  timer:tc(tuple, test1, [1000000]).
{58,{'EXIT',{badarg,[]}}}

9> tuple:populate1([], 0).
[]
10> tuple:populate1([], 1).
[1]
11> tuple:populate1([], 2).

=ERROR REPORT==== 9-Jul-2005::20:27:33 ===
Error in process <0.42.0> with exit value: {badarg,[]}

** exited: {badarg,[]} **

     Thanks, Joel

--
http://wagerlabs.com/uptick






More information about the erlang-questions mailing list