Newbie question about scoping rules



Try g(s):=print(  apply(s,[4]) )$

Then g(cat);
Gives  cat[4].

Lisp has two name spaces, one for variable/value bindings and another for
variable/function bindings.

To some extent Maxima does the same thing, though evaluating sometimes
oversteps this.

Rjf


> -----Original Message-----
> From: maxima-bounces at math.utexas.edu [mailto:maxima-
> bounces at math.utexas.edu] On Behalf Of miguel lopez
> Sent: Wednesday, December 27, 2006 1:00 PM
> To: maxima at math.utexas.edu
> Subject: Re: [Maxima] Newbie question about scoping rules
> 
> Michel Van den Bergh <michel.vandenbergh <at> uhasselt.be> writes:
> 
> >
> > Sorry for all the questions but maxima behaves quite differently from
> > the languages I am used to (python, c)
> >
> 
> s[n]:=n^2;
> g(s):=block([i],print(s[4]));
> g(cat);
> 
>   it gives 16.
> 
> 
> 
> 
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima