scope, and returning values by changing input args



My suggestion is that you never use :: ever.

Without knowing what you really want to do, let me just
suggest that if you want to return several values from a program,
you return a list.

h: charsets(stuff1,stuff2)

qs:h[1],
otherstuff:h[2]

where charsets returns  [internalqs, otherstuff]



Dan Stanger wrote:

> 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
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>