From 40a73cb0e13565894c6cc418719dd1ccd45327f2 Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Mon, 29 Oct 2001 19:29:02 +0000 Subject: [PATCH] The last 3 evaluated expressions in ginsh are now referred to with the tokens '%', '%%' and '%%%'. The old '"', '""' and '"""' remain for compatibility but may be removed in a future version of GiNaC. --- NEWS | 3 +++ doc/tutorial/ginac.texi | 10 +++++----- ginsh/ginsh.1.in | 4 ++-- ginsh/ginsh_lexer.ll | 3 +++ 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 52f9a4c6..ae20f984 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ This file records noteworthy changes. 0.9.5 () * Some internal reorganization resulting in a general speed-up. +* The last 3 evaluated expressions in ginsh are now referred to with the + tokens '%', '%%' and '%%%'. The old '"', '""' and '"""' remain for + compatibility but may be removed in a future version of GiNaC. 0.9.4 (20 September 2001) * Functions have better support for external scripting languages. diff --git a/doc/tutorial/ginac.texi b/doc/tutorial/ginac.texi index 94ec39ee..28a87bf6 100644 --- a/doc/tutorial/ginac.texi +++ b/doc/tutorial/ginac.texi @@ -364,7 +364,7 @@ lambda^2-3*lambda+11 [[1,1],[2,-1]] > A+2*M; [[1,1],[2,-1]]+2*[[1,3],[-3,2]] -> evalm("); +> evalm(%); [[3,7],[-4,3]] > B = [ [0, 0, a], [b, 1, -b], [-1/a, 0, 0] ]; > evalm(B^(2^12345)); @@ -406,7 +406,7 @@ x^(-1)-1/3*x+Order(x^2) > series(tgamma(x),x==0,3); x^(-1)-Euler+(1/12*Pi^2+1/2*Euler^2)*x+ (-1/3*zeta(3)-1/12*Pi^2*Euler-1/6*Euler^3)*x^2+Order(x^3) -> evalf("); +> evalf(%); x^(-1)-0.5772156649015328606+(0.9890559953279725555)*x -(0.90747907608088628905)*x^2+Order(x^3) > series(tgamma(2*sin(x)-2),x==Pi/2,6); @@ -414,7 +414,7 @@ x^(-1)-0.5772156649015328606+(0.9890559953279725555)*x -Euler-1/12+Order((x-1/2*Pi)^3) @end example -Here we have made use of the @command{ginsh}-command @code{"} to pop the +Here we have made use of the @command{ginsh}-command @code{%} to pop the previously evaluated element from @command{ginsh}'s internal stack. If you ever wanted to convert units in C or C++ and found this is @@ -3166,7 +3166,7 @@ the list. @code{find()} returns false if no matches were found (in (Note the absence of "x".) > expand((sin(x)+sin(y))*(a+b)); sin(y)*a+sin(x)*b+sin(x)*a+sin(y)*b -> find(",sin($1)); +> find(%,sin($1)); @{sin(y),sin(x)@} @end example @@ -5629,7 +5629,7 @@ AC_PROG_CXX AC_PROG_INSTALL AC_LANG_CPLUSPLUS -AM_PATH_GINAC(0.7.0, [ +AM_PATH_GINAC(0.9.0, [ LIBS="$LIBS $GINACLIB_LIBS" CPPFLAGS="$CPPFLAGS $GINACLIB_CPPFLAGS" ], AC_MSG_ERROR([need to have GiNaC installed])) diff --git a/ginsh/ginsh.1.in b/ginsh/ginsh.1.in index a66c23e1..c3b9305e 100644 --- a/ginsh/ginsh.1.in +++ b/ginsh/ginsh.1.in @@ -119,7 +119,7 @@ for example $0, $1 etc. .SS LAST PRINTED EXPRESSIONS ginsh provides the three special symbols .RS -", "" and """ +%, %% and %%% .RE that refer to the last, second last, and third last printed expression, respectively. These are handy if you want to use the results of previous computations in a new @@ -458,7 +458,7 @@ x [[\-x+x^2\-2,(x+1)^2],[c,d]] > determinant(M); \-2*d\-2*x*c\-x^2*c\-x*d+x^2*d\-c -> collect(", x); +> collect(%, x); (\-d\-2*c)*x+(d\-c)*x^2\-2*d\-c > solve quantum field theory; parse error at quantum diff --git a/ginsh/ginsh_lexer.ll b/ginsh/ginsh_lexer.ll index 932f80b4..d9329bfe 100644 --- a/ginsh/ginsh_lexer.ll +++ b/ginsh/ginsh_lexer.ll @@ -88,6 +88,9 @@ score return T_SCORE; \" return T_QUOTE; \"\" return T_QUOTE2; \"\"\" return T_QUOTE3; +\% return T_QUOTE; +\%\% return T_QUOTE2; +\%\%\% return T_QUOTE3; /* numbers */ {D}+ | -- 2.44.0