On Mon, Dec 18, 2023 at 08:29:49AM +0800, Qian Yun wrote:
>
>
> On 12/17/23 23:56, Waldek Hebisch wrote:
> > >
> > > So the "$timedNameStack : local" declaration is the key here.
> >
> > For just restoring value there is construction:
> >
> > fun1(x, $var) ==
> > -- do work
> >
> > fun(x) == fun1(x, $var)
> >
> > The effect is that 'fun1' uses current value of '$var' but any
> > changes inside 'fun1' are discarde when 'fun1' resturns (Lisp
> > restores value that '$var' had at entry to 'fun1').
> >
>
> This is the same as ":local" declaration, right? The ":local"
> declaration creates an implicit "PROG" scope.
There is a subtle difference: ":local" requires explicit initial
value (if you omit inital value you will get NIL). Above,
initial value is taken from function argument. And two-stage
call allows to use current value of variable as initial value
in dynamic scope. AFAIR trying to have the same effect in
one stage did not work.
> > > How about let's proceed like this:
> > >
> > > 1. apply the patch in this mail, to prevent infinity recursion
> >
> > I am affraid that we need to do something in 'interpMap' in (i-map.boot).
> >
>
> So the dynamic variable shadowing should also happen in "interpret1"?
>
> BTW, can you give an example of "interpOnly"? So that I can test it.
Interpreter uses somewhat funky data structures, so it is hard to make
a separate call. "interpOnly" is called when interpreter fails to compile
a function, basically when it does not see that types match.
There is a message:
FriCAS will attempt to step through and interpret the code.
you can use it to search for examples.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/ZX-YrdGUBnRhefXS%40fricas.org.