blob: 23b73535985eb204dff08184bdc380691b481fd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
let rec tailcall4 a b c d =
if a < 0
then b
else tailcall4 (a-1) (b+1) (c+2) (d+3)
let rec tailcall8 a b c d e f g h =
if a < 0
then b
else tailcall8 (a-1) (b+1) (c+2) (d+3) (e+4) (f+5) (g+6) (h+7)
let rec tailcall16 a b c d e f g h i j k l m n o p =
if a < 0
then b
else tailcall16 (a-1) (b+1) (c+2) (d+3) (e+4) (f+5) (g+6) (h+7)
(i+8) (j+9) (k+10) (l+11) (m+12) (n+13) (o+14) (p+15)
let indtailcall8 fn a b c d e f g h =
fn a b c d e f g h
let indtailcall16 fn a b c d e f g h i j k l m n o p =
fn a b c d e f g h i j k l m n o p
let _ =
print_int (tailcall4 10000000 0 0 0); print_newline();
print_int (tailcall8 10000000 0 0 0 0 0 0 0); print_newline();
print_int (tailcall16 10000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0); print_newline();
print_int (indtailcall8 tailcall8 10 0 0 0 0 0 0 0); print_newline();
print_int (indtailcall16 tailcall16 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0); print_newline()
|