strange effect



hi every body,
Here is a function of function who works correctly:
-----------------------------------------
intglm2(f,n,param)
:=block(  [h,a,b,v1,vm1,vr5,vmr5,somme,fp],
            if (length(param[1])=1)
           then
                block(
                           [fp,x],
                           define(fp(x),float(f(param[1][1],x))),
                            r:fp(0)
                        )
             else
                    block(
                                  [gp:?gensym(),x:?gensym()],
                                  define(
gp(x),intglm2(f,n,[[x],[param[2][1](x),param[2][2](x)]])),
                                  r:gp(0)+gp(1/4)+gp(2/4)+gp(3/4)
                                 ),
                r
                );
--------------------------------------------------------
But the following function of function does not work:
----------------------------------------------------------
intglm2(f,n,param)
:=block(  [h,a,b,v1,vm1,vr5,vmr5,somme,fp],
            if (length(param[1])=1)
           then
                block(
                           [fp,x],
                           define(fp(x),float(f(param[1][1],x))),
                            r:fp(0)
                        )
             else
                    block(
                                  [gp:?gensym(),x:?gensym()],
                                  define(
gp(x),intglm2(f,n,[[x],[param[2][1](x),param[2][2](x)]])),
                                  r:0,
                                   for i:0 thru 3 do
                                   (r:r+gp(i/4),r)

                                 ),
                r
                );
-----------------------------------------------

If anybody can explain.
Thanks
JDF