@@ -186,14 +186,18 @@ This section will describe the definitions for organizing computations. At pres
@node Parameters, , Introduction to organization, Organization of Computation
@section Parameters
@cindex Parameters
Parameters are named values that are defined and used in computations or in presentation; the concept is distinct from Common Lisp's @url{http://www.lispworks.com/documentation/HyperSpec/Body/m_defpar.htm#defparameter,defparameter} macro. They are organized into named categories; Antik itself defines one category, @code{NF}, which is used for numerical formatting. Each parameter is defined with a default value and description. The value can be changed with @code{(setf parameter-value)} and used with @code{parameter-value}, or changed locally (analogous to @code{let} for CL variables) with @code{with-parameters}.
Parameters are named values that are defined and used in computations or in presentation. The @url{http://www.lispworks.com/documentation/HyperSpec/Body/m_defpar.htm#defparameter,defparameter} macro defines parameters (dynamic variables) but Antik has definitions that permit grouping them and including properties such as the type, which will be checked when values are assigned, and defining synonyms. The grouping is in named categories; Antik itself defines one category, @code{NF}, which is used for numerical formatting. Each category used will become a package, and the symbols exported from that package. The value can be changed with @code{(setf parameter-value)} and used with @code{parameter-value}, or changed locally (analogous to @code{let} for CL variables) with @code{with-parameters}. It is also permissible to assign as a normal variable (e.g., with let and setf), but no type checking is performed.
@example
;;; First create the category
(define-parameter-category kepler)
;;; Then define some parameters
(define-parameter kepler foo 122 fixnum "A fixnum parameter of kepler.")
(define-parameter kepler bar "hi" string "A string parameter of kepler.")
(define-parameter kepler foo
:value 122
:type fixnum
:documentation "A fixnum parameter of kepler.")
(define-parameter kepler bar
:value "hi"
:type string
:documentation "A string parameter of kepler.")
;;; Get their values
(parameter-value kepler bar)
...
...
@@ -212,7 +216,7 @@ foo: 122, bar: "hi"
NIL
;;; Locally change values
(with-parameters (kepler foo 143bar "bye")
(with-parameters (kepler (foo 143) (bar "bye"))
(show-foo-bar))
foo: 143, bar: "bye"
NIL
...
...
@@ -222,43 +226,40 @@ foo: 122, bar: "hi"
NIL
;;; Make a mistake
(with-parameters (kepler foo 143bar -44)
(with-parameters (kepler (foo 143) (bar -44))
(show-foo-bar))
Error: Value -44 is of type FIXNUM, not of the required type STRING.
;;; Globally change values
(set-parameter-value kepler bar "a new value")
(setf (parameter-value kepler bar) "a new value")
(show-foo-bar)
foo: 122, bar: "a new value"
;;; Set multple values
;;; Set multiple values
(set-parameters kepler bar "xyz" foo 1)
(show-foo-bar)
foo: 1, bar: "xyz"
;;; Get information about the categories and parameters
@@ -1274,47 +1274,39 @@ For units defined by Antik, see the source file @file{antik/physical-quantities/
@node Systems of units, , Dimensions, Physical dimension
@subsection Systems of units
A @dfn{system of units} is a set of units, one for each of the physical dimensions that Antik can handle. A system of units is needed by Antik for printing output and in special cases for converting physical quantities that have a physical dimension defined (e.g. length), but no units. The system of units defined by
@code{*system-of-units*} is used to determine the units in which the output is printed. There are pre-defined several systems of units, @code{*siu*}, @code{*englishu*}, @code{*cgsu*}:
@code{(nf-option :system-of-units)} is used to determine the units in which the output is printed. There are pre-defined several systems of units, @code{si}, @code{english}, @code{cgs}:
So by setting the system of units, you can convert values as needed,
@example
ANTIK-USER> (setf *system-of-units* *siu*)
ANTIK-USER> (set-system-of-units :si)
; No value
ANTIK-USER> #_12_feet
#_3.657600000000000d0_m
ANTIK-USER> (setf *system-of-units* *englishu*)
ANTIK-USER> (set-system-of-units :english)
ANTIK-USER> #_3_m
#_9.842519685039370d0_ft
@end example
A new system of units may be defined with @code{define-sysunits}. One need not define all physical dimensions, but if a unit is needed for a particular dimension and it's not defined, an error will be signalled. For convenience, a system of units may be defined by alteration of an existing system of units. For example, suppose that you wish to have a system of units that is like SI except that lengths are measured in km instead of meters. This will define such a system:
A new system of units may be defined with @code{define-system-of-units}. One need not define all physical dimensions, but if a unit is needed for a particular dimension and it's not defined, an error will be signalled. For convenience, a system of units may be defined by augmentation of an existing system of units. For example, suppose that you wish to have a system of units that is like SI except that lengths are measured in km instead of meters. This will define such a system:
To set the default system of units, use @code{set-default-sysunits}. To define a symbol macro to set a default system of units, use @code{setsys}. The SI system is the initial default system of units. It may be reset as the system of units with the symbol macro @code{si}.
For formatted output of angles, the units (degrees or radians) may be set with the nf option @code{:degrees}, so the system of units may be maintained whether degrees or radians are desired on output.
<p><aname="index-Class_002c-physical_002dquantity-318"></a>Antik has a class <code>physical-quantity</code> which is used to represent values that have physical dimension, such as mass or length; e.g.
<p><aname="index-Class_002c-physical_002dquantity-312"></a>Antik has a class <code>physical-quantity</code> which is used to represent values that have physical dimension, such as mass or length; e.g.
<blockquote><p><aname="index-grid_003a_002aarray_002delement_002dtypes_002dno_002dcomplex_002a-295"></a>All the array element types supported except for complex types.
<blockquote><p><aname="index-grid_003a_002aarray_002delement_002dtypes_002dno_002dcomplex_002a-289"></a>All the array element types supported except for complex types.
<blockquote><p><aname="index-grid_003a_002acstd_002dcl_002dtype_002dmapping_002a-301"></a>An alist of the <code>c</code> standard types as keywords, and the <code>cl</code> type
<blockquote><p><aname="index-grid_003a_002acstd_002dcl_002dtype_002dmapping_002a-295"></a>An alist of the <code>c</code> standard types as keywords, and the <code>cl</code> type
The exception is complex types, which don't have a definition
in the <code>c</code> standard; in that case, the <code>c</code> type is the foreign struct
<blockquote><p><aname="index-grid_003a_002acstd_002dinteger_002dtypes_002a-303"></a>List of integer types supported by <code>cffi</code>, from the <code>cffi</code> docs.
<blockquote><p><aname="index-grid_003a_002acstd_002dinteger_002dtypes_002a-297"></a>List of integer types supported by <code>cffi</code>, from the <code>cffi</code> docs.
<blockquote><p><aname="index-grid_003a_002aprint_002dforeign_002darray_002dreadably_002a-315"></a>Print the contents of the foreign-array with the #m reader macro.
<blockquote><p><aname="index-grid_003a_002aprint_002dforeign_002darray_002dreadably_002a-309"></a>Print the contents of the foreign-array with the #m reader macro.
<li><aaccesskey="1"href="Reader-macro-and-function-_003ccode_003egrid_003c_002fcode_003e.html#Reader-macro-and-function-_003ccode_003egrid_003c_002fcode_003e">Reader macro and function <code>grid</code></a>
<p><aname="index-Class_002c-date-and-time-352"></a><aname="index-Date-353"></a><aname="index-Time-_0028of-day_0029-354"></a><aname="index-Date-and-time_002c-creating-355"></a><aname="index-Reader-macro_002c-date-and-time-356"></a><aname="index-ISO8601-357"></a><aname="index-UTC-_0028coordinated-universal-time_0029-358"></a><aname="index-TAI-_0028atomic-time_0029-359"></a><aname="index-Coordinated-Universal-Time-_0028UTC_0029-360"></a><aname="index-International-Atomic-Time-_0028TAI_0029-361"></a><aname="index-UT1-362"></a><aname="index-Astronomical-time-_0028UT1_0029-363"></a><aname="index-Timezones-364"></a>Dates and times can be represented in Antik with the <code>timepoint</code> class. A timepoint is a specific point in Newtonian time, so includes a date and time, and a <dfn>timescale</dfn> (best thought of as a timezone). Timepoints are most conveniently made with the <dfn>#d</dfn> reader macro; the default timescale is <ahref="http://en.wikipedia.org/wiki/Coordinated_Universal_Time">UTC</a>, and the standard format for specification of timepoints is
<p><aname="index-Class_002c-date-and-time-338"></a><aname="index-Date-339"></a><aname="index-Time-_0028of-day_0029-340"></a><aname="index-Date-and-time_002c-creating-341"></a><aname="index-Reader-macro_002c-date-and-time-342"></a><aname="index-ISO8601-343"></a><aname="index-UTC-_0028coordinated-universal-time_0029-344"></a><aname="index-TAI-_0028atomic-time_0029-345"></a><aname="index-Coordinated-Universal-Time-_0028UTC_0029-346"></a><aname="index-International-Atomic-Time-_0028TAI_0029-347"></a><aname="index-UT1-348"></a><aname="index-Astronomical-time-_0028UT1_0029-349"></a><aname="index-Timezones-350"></a>Dates and times can be represented in Antik with the <code>timepoint</code> class. A timepoint is a specific point in Newtonian time, so includes a date and time, and a <dfn>timescale</dfn> (best thought of as a timezone). Timepoints are most conveniently made with the <dfn>#d</dfn> reader macro; the default timescale is <ahref="http://en.wikipedia.org/wiki/Coordinated_Universal_Time">UTC</a>, and the standard format for specification of timepoints is
<blockquote><p><aname="index-antik_003a_002areal_002dut1_002dutc_002a-368"></a>If <code>nil</code>, <code>ut1</code> will be taken the same as <code>utc</code>.
<blockquote><p><aname="index-antik_003a_002areal_002dut1_002dutc_002a-354"></a>If <code>nil</code>, <code>ut1</code> will be taken the same as <code>utc</code>.
<blockquote><p><aname="index-antik_003aread_002dtimepoint-372"></a>Read a timepoint from a string with specification for the position in the string of each component; pos-ymdhms is a list of year, month, day, hour, minute, and second as sequence numbers for the integers in the string. Scale is the timescale (zone) as a string or symbol. If pos-ymdhms has only three components, or only a date is provided, the timepoint created will be specifed as day-only. The default reads an <code>iso8601</code> string like <code>1999-03-30t12:33:45</code>.
<blockquote><p><aname="index-antik_003aread_002dtimepoint-358"></a>Read a timepoint from a string with specification for the position in the string of each component; pos-ymdhms is a list of year, month, day, hour, minute, and second as sequence numbers for the integers in the string. Scale is the timescale (zone) as a string or symbol. If pos-ymdhms has only three components, or only a date is provided, the timepoint created will be specifed as day-only. The default reads an <code>iso8601</code> string like <code>1999-03-30t12:33:45</code>.
<h2class="chapter">11 Download and installation</h2>
<p><aname="index-Installation-of-Antik-463"></a><aname="index-Download-of-Antik-464"></a><aname="index-Dependencies-of-Antik-on-external-libraries-465"></a>The recommended way to download and install this software is through
<p><aname="index-Installation-of-Antik-449"></a><aname="index-Download-of-Antik-450"></a><aname="index-Dependencies-of-Antik-on-external-libraries-451"></a>The recommended way to download and install this software is through
<ahref="http://www.quicklisp.org/">quicklisp</a>. Install quicklisp following
<p><aname="index-Efficiency-of-computation-for-grids-316"></a><aname="index-Grid_002c-efficiency-of-computation-317"></a>Access to elements of foreign arrays, for getting or setting, can be
<p><aname="index-Efficiency-of-computation-for-grids-310"></a><aname="index-Grid_002c-efficiency-of-computation-311"></a>Access to elements of foreign arrays, for getting or setting, can be
very slow if they are not declared. These declarations can take