scope, and returning values by changing input args



Using a variable with a lisp name, is ok for that function, but the ::
operator does not seem
to work consistantly in all cases.  In the following code qs is bound to
qs1, and qs1 does not seem
to get assigned to:

charsets_sort ( ps,theRankFunction,ord,?qs ):=block(   [ l,i],
      if length ( ps )  = 1 then (
            ?qs ::  [  ]  ,
            ps[1])
         else (
            l : ps[1] ,
            ?qs ::  [  ]  ,
            for i : 2 thru length ( ps )  do
               if theRankFunction( ps[i], l, ord )
                   then (
                     ?qs ::  cons( l, ?qs),
                     l : ps[i])
                  else (
                     ?qs :: cons( ps[i], ?qs)) ,
            l)
)$

I was thinking of constructing a list to pass the args back, and calling
the sort from a macro,
and assign after the call, but it would be a lot easier if I could get
:: working.
Dan Stanger