]> www.ginac.de Git - ginac.git/commitdiff
[DOC] Fix examples using deprecated lst initializers.
authorRichard Kreckel <kreckel@ginac.de>
Fri, 8 Mar 2019 21:33:44 +0000 (22:33 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Fri, 8 Mar 2019 21:37:17 +0000 (22:37 +0100)
doc/tutorial/ginac.texi

index ffdfbef52ed1c17a2aac9a744e35ab9798f533c2..db78219de62a3cd93deaa2ca334362e4929e4be2 100644 (file)
@@ -1659,8 +1659,7 @@ Lists can be constructed from an initializer list of expressions:
 @example
 @{
     symbol x("x"), y("y");
 @example
 @{
     symbol x("x"), y("y");
-    lst l;
-    l = @{x, 2, y, x+y@};
+    lst l = @{x, 2, y, x+y@};
     // now, l is a list holding the expressions 'x', '2', 'y', and 'x+y',
     // in that order
     ...
     // now, l is a list holding the expressions 'x', '2', 'y', and 'x+y',
     // in that order
     ...
@@ -1767,9 +1766,8 @@ You can bring the elements of a list into a canonical order with @code{sort()}:
 
 @example
     ...
 
 @example
     ...
-    lst l1, l2;
-    l1 = x, 2, y, x+y;
-    l2 = 2, x+y, x, y;
+    lst l1 = @{x, 2, y, x+y@};
+    lst l2 = @{2, x+y, x, y@};
     l1.sort();
     l2.sort();
     // l1 and l2 are now equal
     l1.sort();
     l2.sort();
     // l1 and l2 are now equal
@@ -1781,8 +1779,7 @@ elements with @code{unique()}:
 
 @example
     ...
 
 @example
     ...
-    lst l3;
-    l3 = x, 2, 2, 2, y, x+y, y+x;
+    lst l3 = @{x, 2, 2, 2, y, x+y, y+x@};
     l3.unique();        // l3 is now @{x, 2, y, x+y@}
 @}
 @end example
     l3.unique();        // l3 is now @{x, 2, y, x+y@}
 @}
 @end example
@@ -6252,9 +6249,8 @@ let us solve the two equations @code{a*x+b*y==3} and @code{x-y==b}:
 @example
 @{
     symbol a("a"), b("b"), x("x"), y("y");
 @example
 @{
     symbol a("a"), b("b"), x("x"), y("y");
-    lst eqns, vars;
-    eqns = a*x+b*y==3, x-y==b;
-    vars = x, y;
+    lst eqns = @{a*x+b*y==3, x-y==b@};
+    lst vars = @{x, y@};
     cout << lsolve(eqns, vars) << endl;
      // -> @{x==(3+b^2)/(b+a),y==(3-b*a)/(b+a)@}
 @end example
     cout << lsolve(eqns, vars) << endl;
      // -> @{x==(3+b^2)/(b+a),y==(3-b*a)/(b+a)@}
 @end example
@@ -6781,8 +6777,7 @@ And the stored expressions can be retrieved by their name:
 
 @example
     // ...
 
 @example
     // ...
-    lst syms;
-    syms = x, y;
+    lst syms = @{x, y@};
 
     ex ex1 = a2.unarchive_ex(syms, "foo");
     ex ex2 = a2.unarchive_ex(syms, "the second one");
 
     ex ex1 = a2.unarchive_ex(syms, "foo");
     ex ex2 = a2.unarchive_ex(syms, "the second one");