Question regarding passing functions as arguments



I have this routine that computes the coefficients of B-splines in the representation of function f as follows (which works)
-------------------------------------------------------------------


n:13;
k:4;
for i:1 thru 4 do
  (t[i]:0., t[n+i]:10.);

nm4:n-4;
for i:1 thru nm4 do 
  t[i+4]:float(i);

listarray(t);

f(x):=(x-3)*(x-6)*(x-9);


for i:1 thru nm4 do
  (sum:0,
  for j:i thru i+4 do
    sum:sum+t[j],
  tau[i]:sum/5,print(i,j,sum));

listarray(tau);

f(listarray(tau));

define(df(x),diff(f(x),x));

define(d2f(x),diff(f(x),x,2));

df(listarray(tau));
d2f(listarray(tau));

for i:1 thru n do
  (dtip1:t[i+2]-t[i+1],
  dtip2:t[i+3]-t[i+2],
  xx:t[i+2], 
  coef[i]:f(xx)+ (dtip2-dtip1)*df(xx)/3.0 - dtip1*dtip2*d2f(xx)/6.0,
  print(i, " ",dtip1, " ", dtip2, " ", xx, " ", coef[i]));
---------------------------------------------------------------------------------------------
I would like to create a function that does the same thing.  I have tried the following
(which does not work- f and t do not have the right representation)

compCoef[f,n,k,t]:=block([tau,df,d2f],
           for i:1 thru nm4 do
             (sum:0,
               for j:i thru i+4 do
                sum:sum+t[j],
                tau[i]:sum/5,print(i,j,sum)),
           define(d2f(x),diff(f(x),x,2)),
           define(df(x),diff(f(x),x)),
           for i:1 thru n do
             (dtip1:t[i+2]-t[i+1],
              dtip2:t[i+3]-t[i+2],
              xx:t[i+2], 
              coef[i]:f(xx)+ (dtip2-dtip1)*df(xx)/3.0 - dtip1*dtip2*d2f(xx)/6.0,
  print(i, " ",dtip1, " ", dtip2, " ", xx, " ", coef[i]))

)
--------------------------------------------------------------------------------------------------
Questions:-  
 1.  How do I modify the above so it gives the same result, i.e. how to pass f and t )
  2.  How do put comments in a script file?

Thank you for your help.

Ram