How do I make properties(...) work within a function definition?



Re: I wish that for every function that quotes an argument as a
"convenience" there was a corresponding version that didn't!

... or that there was no autoquoting at all... also one of my pet peevs.

(%i6) xx: "+";
(%o6) "+"
(%i7) apply('properties,[xx]);
(%o7) ["mirror symmetry",nary,rule,operator]

On Wed, Nov 2, 2011 at 15:05, David R Stoutemyer <dstout at hawaii.edu> wrote:

> /* I want to programmatically do examples such as the following to see if
> "nary" is a member of the property list: */
>
> properties("+");
> ["mirror symmetry", nary, rule, operator]
>
> /* But I want to obtain the properties of symbols or strings from within a
> function definition, without knowing the particular symbol in advance. Here
> is a minimal such function definition: */
>
> propertyList(symbolOrString) := properties(symbolOrString)$
> /* It doesn't work because evidently properties(...) quotes its argument:
> */
>
> propertyList("+");
> [value]
>
> /* Using the quote quote operator on the top-level argument doesn't work
> because the parser evaluates it, which is too soon: */
>
> propertyList(''"+");
> [value]
>
> /* Putting the quote quote inside the body of the function definition
> doesn't work because the parser
> evaluates it there too: */
>
> propertyList(operator) := properties(''operator)$
> propertyList("+");
> [value]
>
> /* The ev(...) function causes an error message for reasons that are
> unclear to me: */
>
> propertyList(operator) := properties(ev(operator))$
>
> propertyList("+");
> properties: argument must be a symbol or a string.
> #0: propertyList(operator=+)
>  -- an error. To debug this try: debugmode(true);
>
> /* I wish that for every function that quotes an argument as a
> "convenience" there was a
> corresponding version that didn't!  Is there a way to do what I want? */
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>