Fix bug #3950: letsimp confuses symbols and nullary applications
This is an ancient bug that was present in Macsyma.
letsimp confuses symbols foo and nullary applications foo().
When NISEXTRACT is given an argument that is considered to be something
atomic, optionally raised to an exponent, then it returns a dotted list
of the form (THE-ATOM NIL . EXPONENT). When NISEXTRACT is given an
argument that is considered to be an operator applied to args, and
optionally raised to an exponent, then it returns a dotted list of
the form (OPERATOR ARGLIST . EXPONENT).
This is problematic because NISEXTRACT will map, e.g., the symbol
$FOO and the application (($FOO)) to the same value: ($FOO NIL . 1).
NISMATCH and NISBUILD assume that the NIL denotes the atomic case, and
this causes various problems like
(%i1) let (f (), g ())$
(%i2) letsimp (f); /* wrong: this should yield f */
(%o2) g()
(%i3) letsimp (f ()); /* wrong: this should yield g() */
(%o3) f()
and
(%i1) matchdeclare (foo, true)$
(%i2) let (foo (), bar ())$
(%i3) letsimp (x); /* ouch, this should just yield x */
<stack overflow>
Now in the atomic case NISEXTRACT uses T instead of NIL for the second
element of the return value. Now the second element is a list iff it
represents an arg list.
No problems with the test suite or share test suite. New tests have
been added to rtest12.