Question: How to pass a list created by one procedure to another procedure?

I am working on a problem that involves a great deal of combinatorics, and I have broken the problem into several procedures.  I am trying to create a first procedure that creates a list output, a second procedure which takes the list and other input and cycles over combinations of two elements from the list and calls a third procedure to perform the calculus needed for each pair.  A simplified example follows:

f1:=proc(a1, a2, ..., an)
(various if-then statements)

return [b1, b2,...,bn];

end:

 

f2:=proc(alpha, beta,...,L::list)

A:=0;
for i from 1 to n-1 do
     for j from i+1 to n do
     A:= A+ f2(alpha, beta, ..., L[i], L[j])
     end do;
end do;

return A;

end:

 

f3:=proc(alpha, beta, ..., bi, bj)

(various mathematical manipulations)
return x;

end:

 

When I first use f1 to get [b1, b2, ..., bn] and then invoke f2 as f2(alpha, beta, ..., [b1, b2, ..., bn]) everything works fine.

However, f1 needs to be invoked by yet a larger function as follows:
...

L0:=[0,0,0,...,0]:
L0:=f1(a1, a2, ..., an):
B:=f2(alpha, beta,...,L0):

...
When I do this, L0 still gets assigned the correct value according the program trace, yet it fails to invoke f3 correctly.  What could the problem be?

Please Wait...