diff options
| author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-09-13 09:54:12 -0600 |
|---|---|---|
| committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-09-13 09:54:12 -0600 |
| commit | 2e284b71500a1f8dc6cc46ecf21eb1e9389ea780 (patch) | |
| tree | e9227f4ad4e9987dcc64055803ab3e70a5e801ce /cl/src | |
| parent | 2cb14ebf79dd43aa96d54e65a0841d195d07bdf9 (diff) | |
| download | cmath-2e284b71500a1f8dc6cc46ecf21eb1e9389ea780.tar.gz cmath-2e284b71500a1f8dc6cc46ecf21eb1e9389ea780.zip | |
new table macro, notes for 9/11
Diffstat (limited to 'cl/src')
| -rw-r--r-- | cl/src/approx/derivative.lisp | 3 | ||||
| -rw-r--r-- | cl/src/utils/package.lisp | 3 | ||||
| -rw-r--r-- | cl/src/utils/table.lisp | 11 |
3 files changed, 15 insertions, 2 deletions
diff --git a/cl/src/approx/derivative.lisp b/cl/src/approx/derivative.lisp index 280463f..02fcb4c 100644 --- a/cl/src/approx/derivative.lisp +++ b/cl/src/approx/derivative.lisp @@ -5,4 +5,5 @@ (x1 (- x delta)) (y2 (apply f (list x2))) (y1 (apply f (list x1)))) - (/ (- y2 y1) (- x2 x1)))) + (/ (- y2 y1) + (- x2 x1)))) diff --git a/cl/src/utils/package.lisp b/cl/src/utils/package.lisp index 0436a94..bdd5589 100644 --- a/cl/src/utils/package.lisp +++ b/cl/src/utils/package.lisp @@ -1,4 +1,5 @@ (in-package :cl-user) (defpackage lizfcm.utils (:use :cl) - (:export :within-range-p)) + (:export :within-range-p + :table)) diff --git a/cl/src/utils/table.lisp b/cl/src/utils/table.lisp new file mode 100644 index 0000000..e96f37b --- /dev/null +++ b/cl/src/utils/table.lisp @@ -0,0 +1,11 @@ +(in-package :lizfcm.utils) + +(defmacro table ((&key headers domain-order domain-values) &body body) + `(cons + ,headers + (mapcar (lambda (tuple) + (destructuring-bind ,domain-order tuple + (append tuple + (list + ,@body)))) + ,domain-values))) |
