On Mon, May 4, 2009 at 12:10 PM, Leo Butler <l.butler at ed.ac.uk> wrote:
> (%i4) declare(FOO,feature)
> (%o4) done
> (%i5)
> myfn():=block([BAR],declare(BAR,FOO),print(featurep(BAR,FOO)),BAR:"2",
> print(featurep(BAR,FOO)),declare(BAR,FOO),
> print(featurep(BAR,FOO),featurep(BAR,string)),done)
> (%i6) myfn()
> true
> false
> false false
> (%o6) done
>
> As you can see, I declare BAR to be a FOO, and maxima knows this. When I
> assign a value to BAR, maxima forgets my previous declaration and even
> if I repeat this declaration, maxima ignores it.
>
> (Note, too, that featurep is unable to determine that BAR is also a
> string).
featurep is an ordinary function, which evaluates its arguments.
After you assign a value to BAR, featurep sees the value, not
the symbol BAR. Maybe you want featurep('BAR, FOO) ??
featurep has accreted various bits over the years, but it is not
a general type-checking function (not yet anyway).
Maybe you can explain what you're trying to do and we'll be
able to figure out a way to achieve it.
FWIW
Robert Dodier