Commit 250eedb5 authored by Liam M. Healy's avatar Liam M. Healy
Browse files

New macro define-derived-system-of-units

The new macro define-derived-system-of-units is like define-system-of-units except that it also takes a base system of units from which to derive the new system of units, and does not default to the current system of units.
parent bc899205
;; Define physical dimensions and units of measure and systems of units.
;; Liam Healy Wed Feb 27 2002 - 13:18
;; Time-stamp: <2013-03-24 19:52:42EDT units.lisp>
;; Time-stamp: <2013-03-30 10:36:42EDT units.lisp>
;; Copyright 2011, 2013 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -23,7 +23,8 @@
(export '(dimension
get-canonical-name print-name
long-print-name short-print-name tex-print-name
define-system-of-units define-unit define-units
define-system-of-units define-derived-system-of-units
define-unit define-units
define-physical-constant
set-default-system-of-units
reset-system-of-units
......@@ -194,12 +195,19 @@
(or (find-if #'sysunitsp nonils)
(when augment-current (nf-option :system-of-units))))))
(defmacro define-system-of-units (system-name units-or-system docstring)
(defmacro define-system-of-units (system-name units-or-system &optional docstring)
"Make a system of units with the given name and units."
`(defparameter ,system-name
(make-sysunits ',units-or-system nil)
,docstring))
(defmacro define-derived-system-of-units
(system-name units-or-system base-system &optional docstring)
"Make a system of units with the given name and units."
`(defparameter ,system-name
(make-sysunits (append ',units-or-system (list ,base-system)) nil)
,docstring))
(defun set-default-system-of-units (&rest units-or-system)
"Set the default system of units to the specified system."
(setf
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment