Next: Standards Support, Previous: Sorting and Searching, Up: Other Packages [Contents][Index]
Anything that doesn’t fall neatly into any of the other categories winds up here.
Next: String-Case, Previous: Procedures, Up: Procedures [Contents][Index]
(require 'coerce)
Returns a symbol name for the type of obj.
Converts and returns obj of type char
, number
,
string
, symbol
, list
, or vector
to
result-type (which must be one of these symbols).
Next: String Ports, Previous: Type Coercion, Up: Procedures [Contents][Index]
(require 'string-case)
The obvious string conversion routines. These are non-destructive.
The destructive versions of the functions above.
Converts string str to a symbol having the same case as if the
symbol had been read
.
Converts obj1 … to strings, appends them, and converts to a symbol which is returned. Strings and numbers are converted to read’s symbol case; the case of symbol characters is not changed. #f is converted to the empty string (symbol).
delimiter must be a string or character. If absent,
delimiter defaults to ‘-’. StudlyCapsExpand
returns a
copy of str where delimiter is inserted between each
lower-case character immediately followed by an upper-case character;
and between two upper-case characters immediately followed by a
lower-case character.
(StudlyCapsExpand "aX" " ") ⇒ "a X" (StudlyCapsExpand "aX" "..") ⇒ "a..X" (StudlyCapsExpand "AX") ⇒ "AX" (StudlyCapsExpand "Ax") ⇒ "Ax" (StudlyCapsExpand "AXLE") ⇒ "AXLE" (StudlyCapsExpand "aAXACz") ⇒ "a-AXA-Cz" (StudlyCapsExpand "AaXACz") ⇒ "Aa-XA-Cz" (StudlyCapsExpand "AAaXACz") ⇒ "A-Aa-XA-Cz" (StudlyCapsExpand "AAaXAC") ⇒ "A-Aa-XAC"
Next: Line I/O, Previous: String-Case, Up: Procedures [Contents][Index]
(require 'string-port)
proc must be a procedure of one argument. This procedure calls proc with one argument: a (newly created) output port. When the function returns, the string composed of the characters written into the port is returned.
proc must be a procedure of one argument. This procedure calls proc with one argument: an (newly created) input port from which string’s contents may be read. When proc returns, the port is closed and the value yielded by the procedure proc is returned.
Next: Multi-Processing, Previous: String Ports, Up: Procedures [Contents][Index]
(require 'line-i/o)
Returns a string of the characters up to, but not including a
newline or end of file, updating port to point to the
character following the newline. If no characters are available, an
end of file object is returned. The port argument may be
omitted, in which case it defaults to the value returned by
current-input-port
.
Fills string with characters up to, but not including a newline or end
of file, updating the port to point to the last character read
or following the newline if it was read. If no characters are
available, an end of file object is returned. If a newline or end
of file was found, the number of characters read is returned.
Otherwise, #f
is returned. The port argument may be
omitted, in which case it defaults to the value returned by
current-input-port
.
Writes string followed by a newline to the given port and returns
an unspecified value. The Port argument may be omitted, in
which case it defaults to the value returned by
current-input-port
.
command must be a string. The string tmp, if supplied, is a path to use as
a temporary file. system->line
calls system
with command as argument,
redirecting stdout to file tmp. system->line
returns a string containing the
first line of output from tmp.
system->line
is intended to be a portable method for getting one-line results
from programs like pwd
, whoami
, hostname
,
which
, identify
, and cksum
. Its behavior when
called with programs which generate lots of output is unspecified.
Next: Metric Units, Previous: Line I/O, Up: Procedures [Contents][Index]
(require 'process)
This module implements asynchronous (non-polled) time-sliced
multi-processing in the SCM Scheme implementation using procedures
alarm
and alarm-interrupt
.
Until this is ported to another implementation, consider it an example
of writing schedulers in Scheme.
Adds proc, which must be a procedure (or continuation) capable of
accepting accepting one argument, to the process:queue
. The
value returned is unspecified. The argument to proc should be
ignored. If proc returns, the process is killed.
Saves the current process on process:queue
and runs the next
process from process:queue
. The value returned is
unspecified.
Kills the current process and runs the next process from
process:queue
. If there are no more processes on
process:queue
, (slib:exit)
is called (see System).
Previous: Multi-Processing, Up: Procedures [Contents][Index]
(require 'metric-units)
http://people.csail.mit.edu/jaffer/MIXF
Metric Interchange Format is a character string encoding for numerical values and units which:
In the expression for the value of a quantity, the unit symbol is placed after the numerical value. A dot (PERIOD, ‘.’) is placed between the numerical value and the unit symbol.
Within a compound unit, each of the base and derived symbols can optionally have an attached SI prefix.
Unit symbols formed from other unit symbols by multiplication are indicated by means of a dot (PERIOD, ‘.’) placed between them.
Unit symbols formed from other unit symbols by division are indicated by means of a SOLIDUS (‘/’) or negative exponents. The SOLIDUS must not be repeated in the same compound unit unless contained within a parenthesized subexpression.
The grouping formed by a prefix symbol attached to a unit symbol constitutes a new inseparable symbol (forming a multiple or submultiple of the unit concerned) which can be raised to a positive or negative power and which can be combined with other unit symbols to form compound unit symbols.
The grouping formed by surrounding compound unit symbols with parentheses (‘(’ and ‘)’) constitutes a new inseparable symbol which can be raised to a positive or negative power and which can be combined with other unit symbols to form compound unit symbols.
Compound prefix symbols, that is, prefix symbols formed by the juxtaposition of two or more prefix symbols, are not permitted.
Prefix symbols are not used with the time-related unit symbols min (minute), h (hour), d (day). No prefix symbol may be used with dB (decibel). Only submultiple prefix symbols may be used with the unit symbols L (liter), Np (neper), o (degree), oC (degree Celsius), rad (radian), and sr (steradian). Submultiple prefix symbols may not be used with the unit symbols t (metric ton), r (revolution), or Bd (baud).
A unit exponent follows the unit, separated by a CIRCUMFLEX (‘^’). Exponents may be positive or negative. Fractional exponents must be parenthesized.
Factor Name Symbol | Factor Name Symbol ====== ==== ====== | ====== ==== ====== 1e24 yotta Y | 1e-1 deci d 1e21 zetta Z | 1e-2 centi c 1e18 exa E | 1e-3 milli m 1e15 peta P | 1e-6 micro u 1e12 tera T | 1e-9 nano n 1e9 giga G | 1e-12 pico p 1e6 mega M | 1e-15 femto f 1e3 kilo k | 1e-18 atto a 1e2 hecto h | 1e-21 zepto z 1e1 deka da | 1e-24 yocto y
These binary prefixes are valid only with the units B (byte) and bit. However, decimal prefixes can also be used with bit; and decimal multiple (not submultiple) prefixes can also be used with B (byte).
Factor (power-of-2) Name Symbol ====== ============ ==== ====== 1.152921504606846976e18 (2^60) exbi Ei 1.125899906842624e15 (2^50) pebi Pi 1.099511627776e12 (2^40) tebi Ti 1.073741824e9 (2^30) gibi Gi 1.048576e6 (2^20) mebi Mi 1.024e3 (2^10) kibi Ki
Type of Quantity Name Symbol Equivalent ================ ==== ====== ========== time second s time minute min = 60.s time hour h = 60.min time day d = 24.h frequency hertz Hz s^-1 signaling rate baud Bd s^-1 length meter m volume liter L dm^3 plane angle radian rad solid angle steradian sr rad^2 plane angle revolution * r = 6.283185307179586.rad plane angle degree * o = 2.777777777777778e-3.r information capacity bit bit information capacity byte, octet B = 8.bit mass gram g mass ton t Mg mass unified atomic mass unit u = 1.66053873e-27.kg amount of substance mole mol catalytic activity katal kat mol/s thermodynamic temperature kelvin K centigrade temperature degree Celsius oC luminous intensity candela cd luminous flux lumen lm cd.sr illuminance lux lx lm/m^2 force newton N m.kg.s^-2 pressure, stress pascal Pa N/m^2 energy, work, heat joule J N.m energy electronvolt eV = 1.602176462e-19.J power, radiant flux watt W J/s logarithm of power ratio neper Np logarithm of power ratio decibel * dB = 0.1151293.Np electric current ampere A electric charge coulomb C s.A electric potential, EMF volt V W/A capacitance farad F C/V electric resistance ohm Ohm V/A electric conductance siemens S A/V magnetic flux weber Wb V.s magnetic flux density tesla T Wb/m^2 inductance henry H Wb/A radionuclide activity becquerel Bq s^-1 absorbed dose energy gray Gy m^2.s^-2 dose equivalent sievert Sv m^2.s^-2
* The formulas are:
If the strings from-unit and to-unit express valid unit
expressions for quantities of the same unit-dimensions, then the value
returned by si:conversion-factor
will be such that multiplying a
numerical value expressed in from-units by the returned conversion
factor yields the numerical value expressed in to-units.
Otherwise, si:conversion-factor
returns:
if neither from-unit nor to-unit is a syntactically valid unit.
if from-unit is not a syntactically valid unit.
if to-unit is not a syntactically valid unit.
if linear conversion (by a factor) is not possible.
(si:conversion-factor "km/s" "m/s" ) ⇒ 0.001 (si:conversion-factor "N" "m/s" ) ⇒ 0 (si:conversion-factor "moC" "oC" ) ⇒ 1000 (si:conversion-factor "mK" "oC" ) ⇒ 0 (si:conversion-factor "rad" "o" ) ⇒ 0.0174533 (si:conversion-factor "K" "o" ) ⇒ 0 (si:conversion-factor "K" "K" ) ⇒ 1 (si:conversion-factor "oK" "oK" ) ⇒ -3 (si:conversion-factor "" "s/s" ) ⇒ 1 (si:conversion-factor "km/h" "mph" ) ⇒ -2
Next: Standards Support, Previous: Sorting and Searching, Up: Other Packages [Contents][Index]