Maxima Operator
''
The quote-quote operator '@w'
(two single quote marks) modifies evaluation in input expressions.
Applied to a general expression expr, quote-quote causes the value of expr to be substituted for expr in the input expression.
Applied to the operator of an expression, quote-quote changes the operator from a noun to a verb (if it is not already a verb).
The quote-quote operator is applied by the input parser;
it is not stored as part of a parsed input expression.
The quote-quote operator is always applied as soon as it is parsed,
and cannot be quoted.
Thus quote-quote causes evaluation when evaluation is otherwise suppressed,
such as in function definitions, lambda expressions, and expressions quoted by single quote '
.
Quote-quote is recognized by batch
and load
.
See also the single-quote operator and .
Examples:
Applied to a general expression expr, quote-quote causes the value of expr to be substituted for expr in the input expression.
(%i1) expand ((a + b)^3); 3 2 2 3 (%o1) b + 3 a b + 3 a b + a (%i2) [_, ''_]; 3 3 2 2 3 (%o2) [expand((b + a) ), b + 3 a b + 3 a b + a ] (%i3) [%i1, ''%i1]; 3 3 2 2 3 (%o3) [expand((b + a) ), b + 3 a b + 3 a b + a ] (%i4) [aa : cc, bb : dd, cc : 17, dd : 29]; (%o4) [cc, dd, 17, 29] (%i5) foo_1 (x) := aa - bb * x; (%o5) foo_1(x) := aa - bb x (%i6) foo_1 (10); (%o6) cc - 10 dd (%i7) ''%; (%o7) - 273 (%i8) ''(foo_1 (10)); (%o8) - 273 (%i9) foo_2 (x) := ''aa - ''bb * x; (%o9) foo_2(x) := cc - dd x (%i10) foo_2 (10); (%o10) - 273 (%i11) [x0 : x1, x1 : x2, x2 : x3]; (%o11) [x1, x2, x3] (%i12) x0; (%o12) x1 (%i13) ''x0; (%o13) x2 (%i14) '' ''x0; (%o14) x3
Applied to the operator of an expression, quote-quote changes the operator from a noun to a verb (if it is not already a verb).
(%i1) sin (1); (%o1) sin(1) (%i2) ''sin (1); (%o2) 0.8414709848079 (%i3) declare (foo, noun); (%o3) done (%i4) foo (x) := x - 1729; (%o4) ''foo(x) := x - 1729 (%i5) foo (100); (%o5) foo(100) (%i6) ''foo (100); (%o6) - 1629
The quote-quote operator is applied by the input parser; it is not stored as part of a parsed input expression.
(%i1) [aa : bb, cc : dd, bb : 1234, dd : 5678]; (%o1) [bb, dd, 1234, 5678] (%i2) aa + cc; (%o2) dd + bb (%i3) display (_, op (_), args (_)); _ = cc + aa op(cc + aa) = + args(cc + aa) = [cc, aa] (%o3) done (%i4) ''(aa + cc); (%o4) 6912 (%i5) display (_, op (_), args (_)); _ = dd + bb op(dd + bb) = + args(dd + bb) = [dd, bb] (%o5) done
Quote-quote causes evaluation when evaluation is otherwise suppressed,
such as in function definitions, lambda expressions, and expressions quoted by single quote '
.
(%i1) foo_1a (x) := ''(integrate (log (x), x)); (%o1) foo_1a(x) := x log(x) - x (%i2) foo_1b (x) := integrate (log (x), x); (%o2) foo_1b(x) := integrate(log(x), x) (%i3) dispfun (foo_1a, foo_1b); (%t3) foo_1a(x) := x log(x) - x (%t4) foo_1b(x) := integrate(log(x), x) (%o4) [%t3, %t4] (%i4) integrate (log (x), x); (%o4) x log(x) - x (%i5) foo_2a (x) := ''%; (%o5) foo_2a(x) := x log(x) - x (%i6) foo_2b (x) := %; (%o6) foo_2b(x) := % (%i7) dispfun (foo_2a, foo_2b); (%t7) foo_2a(x) := x log(x) - x (%t8) foo_2b(x) := % (%o8) [%t7, %t8] (%i8) F : lambda ([u], diff (sin (u), u)); (%o8) lambda([u], diff(sin(u), u)) (%i9) G : lambda ([u], ''(diff (sin (u), u))); (%o9) lambda([u], cos(u)) (%i10) '(sum (a[k], k, 1, 3) + sum (b[k], k, 1, 3)); (%o10) sum(b , k, 1, 3) + sum(a , k, 1, 3) k k (%i11) '(''(sum (a[k], k, 1, 3)) + ''(sum (b[k], k, 1, 3))); (%o11) b + a + b + a + b + a 3 3 2 2 1 1