@@ -1,775 +1,775 @@ -REDUCE 3.6, 15-Jul-95, patched to 6 Mar 96 ... - - -Comment This is a standard test file for REDUCE that has been used for -many years. It only tests a limited number of facilities in the -current system. In particular, it does not test floating point -arithmetic, or any of the more advanced packages that have been made -available since REDUCE 3.0 was released. It has been used for a long -time to benchmark the performance of REDUCE. A description of this -benchmarking with statistics for REDUCE 3.2 was reported in Jed B. -Marti and Anthony C. Hearn, "REDUCE as a Lisp Benchmark", SIGSAM Bull. -19 (1985) 8-16. That paper also gives information on the the parts of -the system exercised by the test file. Updated statistics may be found -in the "timings" file in the REDUCE Network Library; - - -showtime; - - -Time: 20 ms - - -comment some examples of the FOR statement; - - -comment summing the squares of the even positive integers - through 50; - - -for i:=2 step 2 until 50 sum i**2; - - -22100 - - -comment to set w to the factorial of 10; - - -w := for i:=1:10 product i; - - -w := 3628800 - - -comment alternatively, we could set the elements a(i) of the - array a to the factorial of i by the statements; - - -array a(10); - - - -a(0):=1$ - - - -for i:=1:10 do a(i):=i*a(i-1); - - - -comment the above version of the FOR statement does not return - an algebraic value, but we can now use these array - elements as factorials in expressions, e. g.; - - -1+a(5); - - -121 - - -comment we could have printed the values of each a(i) - as they were computed by writing the FOR statement as; - - -for i:=1:10 do write a(i):= i*a(i-1); - - -a(1) := 1 - -a(2) := 2 - -a(3) := 6 - -a(4) := 24 - -a(5) := 120 - -a(6) := 720 - -a(7) := 5040 - -a(8) := 40320 - -a(9) := 362880 - -a(10) := 3628800 - - -comment another way to use factorials would be to introduce an -operator FAC by an integer procedure as follows; - - -integer procedure fac (n); - begin integer m; - m:=1; - l1: if n=0 then return m; - m:=m*n; - n:=n-1; - go to l1 - end; - - -fac - - -comment we can now use fac as an operator in expressions, e. g.; - - -z**2+fac(4)-2*fac 2*y; - - - 2 - - 4*y + z + 24 - - -comment note in the above example that the parentheses around -the arguments of FAC may be omitted since it is a unary operator; - - -comment the following examples illustrate the solution of some - complete problems; - - -comment the f and g series (ref Sconzo, P., Leschack, A. R. and - Tobey, R. G., Astronomical Journal, Vol 70 (May 1965); - - -deps:= -sigma*(mu+2*epsilon)$ - - -dmu:= -3*mu*sigma$ - - -dsig:= epsilon-2*sigma**2$ - - -f1:= 1$ - - -g1:= 0$ - - - -for i:= 1:8 do - <