source: CGBLisp/src/RCS/example.lisp,v@ 1

Last change on this file since 1 was 1, checked in by Marek Rychlik, 15 years ago

First import of a version circa 1997.

File size: 2.9 KB
Line 
1head 1.2;
2access;
3symbols;
4locks; strict;
5comment @;;; @;
6
7
81.2
9date 2009.01.22.04.01.51; author marek; state Exp;
10branches;
11next 1.1;
12
131.1
14date 2009.01.19.07.49.49; author marek; state Exp;
15branches;
16next ;
17
18
19desc
20@@
21
22
231.2
24log
25@*** empty log message ***
26@
27text
28@#|
29 $Id$
30 *--------------------------------------------------------------------------*
31 | Copyright (C) 1994, Marek Rychlik (e-mail: rychlik@@math.arizona.edu) |
32 | Department of Mathematics, University of Arizona, Tucson, AZ 85721 |
33 | |
34 | Everyone is permitted to copy, distribute and modify the code in this |
35 | directory, as long as this copyright note is preserved verbatim. |
36 *--------------------------------------------------------------------------*
37|#
38
39(defpackage "CGB-LISP"
40 (:use "MAKELIST" "ORDER" "MONOM" "COEFFICIENT-RING"
41 "TERM" "POLY" "DIVISION" "PARSE" "PRINTER" "POLY-WITH-SUGAR"
42 "GROBNER" "COLORED-POLY" "POLY-GCD" "RAT" "RATPOLY"
43 "STRING-GROBNER" "DYNAMICS"
44 "INFIX"))
45
46#+debug(proclaim '(optimize (speed 0) (debug 3)))
47#-debug(proclaim '(optimize (speed 3) (debug 0)))
48
49(defun example (symbol &optional (stream t))
50 "Run short examples associated with a symbol, which typically is a function name."
51 (dolist (e (cdr (assoc symbol *examples*)))
52 (run-example e stream))
53 (values))
54
55(defun run-example (e stream)
56 "Evaluate a single form E and send output to stream STREAM."
57 (format stream "~%;;----------------------------------------------------------------")
58 (format stream "~%;;")
59 (format stream "~%;;~1T~S" e)
60 (format stream "~%;;")
61 (format stream "~%;;----------------------------------------------------------------~&")
62 (dolist (val (multiple-value-list (eval e)))
63 (format stream "[ RETURN VALUE ]-->> ~S~&" val))
64 (values))
65
66(defun all-examples (&optional (stream t))
67 "Run all available examples and send output to STREAM."
68 (dolist (a *examples*)
69 (dolist (e (cdr a))
70 (run-example e stream)))
71 (values))
72
73
74(defvar *examples*
75 '((string-grobner . ((string-grobner "[x^2+y,x-y]" '(x y))
76 (string-grobner "[y-x^2,z-x^3]" '(x y z) :order #'grevlex>)))
77 (string-grobner-system . ((string-grobner-system "[u*x+y,x+y]" '(x y) '(u))
78 (string-grobner-system "[u*x+y,x+y]" '(x y) '(u) :cover '(("[u-1]" "[]")))))
79 (string-read-poly . ((string-read-poly "[x^3+3*x^2+3*x+1]" '(x))))
80 (string-elimination-ideal . ((string-elimination-ideal "[x^2+y^2-2,x*y-1]" '(x y) 1)))
81 (string-ideal-saturation . ((string-ideal-saturation "[x^2*y,y^3]" "x" '(x y))))
82 (string-ideal-polysaturation . ((string-ideal-polysaturation "[x^2*y,y^3]" "[x,y]" '(x y)))))
83 "A list of available examples.")
84
85
86@
87
88
891.1
90log
91@Initial revision
92@
93text
94@d2 1
95a2 1
96 $Id: example.lisp,v 1.30 1997/12/01 05:39:15 marek Exp $
97d19 2
98a20 1
99(proclaim '(optimize (speed 0) (debug 3)))
100@
Note: See TracBrowser for help on using the repository browser.