Package COALTON
Public interface to COALTON.
Types
ARROW
[TYPE]
Type constructor for function types.
Instances
FUNCTOR (
ARROW
:A)RUNTIMEREPR (:A → :B)
BOOLEAN
[TYPE]
Either true or false represented by t
and nil
respectively.
CHAR
[TYPE]
A single character represented as a character
type.
Instances
DOUBLE-FLOAT
[TYPE]
Double precision floating point number. Uses double-float
.
Instances
COMPLEX
DOUBLE-FLOAT
DEFAULT
DOUBLE-FLOAT
DIVIDABLE
INTEGER
DOUBLE-FLOAT
ELEMENTARY
DOUBLE-FLOAT
EQ
DOUBLE-FLOAT
EXPONENTIABLE
DOUBLE-FLOAT
HASH
DOUBLE-FLOAT
INTO
DOUBLE-FLOAT
BIG-FLOAT
INTO
DOUBLE-FLOAT
CREAL
INTO
DOUBLE-FLOAT
STRING
INTO
I16
DOUBLE-FLOAT
INTO
I32
DOUBLE-FLOAT
INTO
I8
DOUBLE-FLOAT
INTO
U16
DOUBLE-FLOAT
INTO
U32
DOUBLE-FLOAT
INTO
U8
DOUBLE-FLOAT
NUM
DOUBLE-FLOAT
ORD
DOUBLE-FLOAT
POLAR
DOUBLE-FLOAT
QUANTIZABLE
DOUBLE-FLOAT
RADICAL
DOUBLE-FLOAT
RATIONAL
DOUBLE-FLOAT
REAL
DOUBLE-FLOAT
RECIPROCABLE
DOUBLE-FLOAT
RUNTIMEREPR
DOUBLE-FLOAT
TRANSFINITE
DOUBLE-FLOAT
TRIGONOMETRIC
DOUBLE-FLOAT
TRYINTO
DOUBLE-FLOAT
FRACTION
STRING
TRYINTO
I64
DOUBLE-FLOAT
STRING
TRYINTO
IFIX
DOUBLE-FLOAT
STRING
TRYINTO
INTEGER
DOUBLE-FLOAT
STRING
TRYINTO
U64
DOUBLE-FLOAT
STRING
TRYINTO
UFIX
DOUBLE-FLOAT
STRING
FRACTION
[TYPE]
A ratio of integers always in reduced form.
Instances
COMPLEX
FRACTION
DIVIDABLE
INTEGER
FRACTION
EQ
FRACTION
INTO
DYADIC
FRACTION
INTO
FRACTION
BIG-FLOAT
INTO
FRACTION
CREAL
INTO
FRACTION
STRING
NUM
FRACTION
ORD
FRACTION
QUANTIZABLE
FRACTION
RATIONAL
FRACTION
REAL
FRACTION
RECIPROCABLE
FRACTION
REMAINDER
FRACTION
RUNTIMEREPR
FRACTION
TRYINTO
DOUBLE-FLOAT
FRACTION
STRING
TRYINTO
SINGLE-FLOAT
FRACTION
STRING
I16
[TYPE]
Signed 16-bit integer capable of storing values in [-32768, 32767]
. Uses (signed-byte 16)
.
Instances
%FILEBYTE
I16
BITS
I16
BOUNDED
I16
COMPLEX
I16
DEFAULT
I16
EQ
I16
FILE
I16
HASH
I16
INTEGRAL
I16
INTO
I16
CREAL
INTO
I16
DOUBLE-FLOAT
INTO
I16
I32
INTO
I16
I64
INTO
I16
IFIX
INTO
I16
INTEGER
INTO
I16
SINGLE-FLOAT
INTO
I16
STRING
INTO
I8
I16
INTO
U8
I16
NUM
I16
ORD
I16
REMAINDER
I16
RUNTIMEREPR
I16
TRYINTO
I16
I8
STRING
TRYINTO
I16
U16
STRING
TRYINTO
I16
U32
STRING
TRYINTO
I16
U64
STRING
TRYINTO
I16
U8
STRING
TRYINTO
I16
UFIX
STRING
TRYINTO
I32
I16
STRING
TRYINTO
I64
I16
STRING
TRYINTO
IFIX
I16
STRING
TRYINTO
INTEGER
I16
STRING
TRYINTO
U16
I16
STRING
TRYINTO
U32
I16
STRING
TRYINTO
U64
I16
STRING
TRYINTO
UFIX
I16
STRING
I32
[TYPE]
Signed 32-bit integer capable of storing values in [-2147483648, 2147483647]
. Uses (signed-byte 32)
.
Instances
%FILEBYTE
I32
BITS
I32
BOUNDED
I32
COMPLEX
I32
DEFAULT
I32
EQ
I32
FILE
I32
HASH
I32
INTEGRAL
I32
INTO
I16
I32
INTO
I32
CREAL
INTO
I32
DOUBLE-FLOAT
INTO
I32
I64
INTO
I32
IFIX
INTO
I32
INTEGER
INTO
I32
STRING
INTO
I8
I32
INTO
U16
I32
INTO
U8
I32
NUM
I32
ORD
I32
QUANTIZABLE
I32
RATIONAL
I32
REAL
I32
REMAINDER
I32
RUNTIMEREPR
I32
TRYINTO
I32
I16
STRING
TRYINTO
I32
I8
STRING
TRYINTO
I32
SINGLE-FLOAT
STRING
TRYINTO
I32
U16
STRING
TRYINTO
I32
U32
STRING
TRYINTO
I32
U64
STRING
TRYINTO
I32
U8
STRING
TRYINTO
I32
UFIX
STRING
TRYINTO
I64
I32
STRING
TRYINTO
IFIX
I32
STRING
TRYINTO
INTEGER
I32
STRING
TRYINTO
U32
I32
STRING
TRYINTO
U64
I32
STRING
TRYINTO
UFIX
I32
STRING
I64
[TYPE]
Signed 64-bit integer capable of storing values in [-9223372036854775808, 9223372036854775807]
. Uses (signed-byte 64)
.
Instances
%FILEBYTE
I64
BITS
I64
BOUNDED
I64
COMPLEX
I64
DEFAULT
I64
EQ
I64
FILE
I64
HASH
I64
INTEGRAL
I64
INTO
I16
I64
INTO
I32
I64
INTO
I64
CREAL
INTO
I64
INTEGER
INTO
I64
STRING
INTO
I8
I64
INTO
IFIX
I64
INTO
U16
I64
INTO
U32
I64
INTO
U8
I64
INTO
UFIX
I64
NUM
I64
ORD
I64
QUANTIZABLE
I64
RATIONAL
I64
REAL
I64
REMAINDER
I64
RUNTIMEREPR
I64
TRYINTO
I64
DOUBLE-FLOAT
STRING
TRYINTO
I64
I16
STRING
TRYINTO
I64
I32
STRING
TRYINTO
I64
I8
STRING
TRYINTO
I64
IFIX
STRING
TRYINTO
I64
SINGLE-FLOAT
STRING
TRYINTO
I64
U16
STRING
TRYINTO
I64
U32
STRING
TRYINTO
I64
U64
STRING
TRYINTO
I64
U8
STRING
TRYINTO
I64
UFIX
STRING
TRYINTO
INTEGER
I64
STRING
TRYINTO
U64
I64
STRING
I8
[TYPE]
Signed 8-bit integer capable of storing values in [-128, 127]
. Uses (signed-byte 8)
.
Instances
%FILEBYTE
I8
BITS
I8
BOUNDED
I8
COMPLEX
I8
DEFAULT
I8
EQ
I8
FILE
I8
HASH
I8
INTEGRAL
I8
INTO
I8
CREAL
INTO
I8
DOUBLE-FLOAT
INTO
I8
I16
INTO
I8
I32
INTO
I8
I64
INTO
I8
IFIX
INTO
I8
INTEGER
INTO
I8
SINGLE-FLOAT
INTO
I8
STRING
NUM
I8
ORD
I8
QUANTIZABLE
I8
RATIONAL
I8
REAL
I8
REMAINDER
I8
RUNTIMEREPR
I8
TRYINTO
I16
I8
STRING
TRYINTO
I32
I8
STRING
TRYINTO
I64
I8
STRING
TRYINTO
I8
U16
STRING
TRYINTO
I8
U32
STRING
TRYINTO
I8
U64
STRING
TRYINTO
I8
U8
STRING
TRYINTO
I8
UFIX
STRING
TRYINTO
IFIX
I8
STRING
TRYINTO
INTEGER
I8
STRING
TRYINTO
U16
I8
STRING
TRYINTO
U32
I8
STRING
TRYINTO
U64
I8
STRING
TRYINTO
U8
I8
STRING
TRYINTO
UFIX
I8
STRING
IFIX
[TYPE]
Non-allocating tagged integer; range is platform-dependent. Does not error on overflow. Uses fixnum
.
Instances
%FILEBYTE
IFIX
BITS
IFIX
BOUNDED
IFIX
COMPLEX
IFIX
DEFAULT
IFIX
EQ
IFIX
FILE
IFIX
HASH
IFIX
INTEGRAL
IFIX
INTO
I16
IFIX
INTO
I32
IFIX
INTO
I8
IFIX
INTO
IFIX
CREAL
INTO
IFIX
I64
INTO
IFIX
INTEGER
INTO
IFIX
STRING
INTO
U16
IFIX
INTO
U32
IFIX
INTO
U8
IFIX
INTO
UFIX
IFIX
NUM
IFIX
ORD
IFIX
QUANTIZABLE
IFIX
RATIONAL
IFIX
REAL
IFIX
REMAINDER
IFIX
RUNTIMEREPR
IFIX
TRYINTO
I64
IFIX
STRING
TRYINTO
IFIX
DOUBLE-FLOAT
STRING
TRYINTO
IFIX
I16
STRING
TRYINTO
IFIX
I32
STRING
TRYINTO
IFIX
I8
STRING
TRYINTO
IFIX
SINGLE-FLOAT
STRING
TRYINTO
IFIX
U16
STRING
TRYINTO
IFIX
U32
STRING
TRYINTO
IFIX
U64
STRING
TRYINTO
IFIX
U8
STRING
TRYINTO
IFIX
UFIX
STRING
TRYINTO
INTEGER
IFIX
STRING
TRYINTO
U64
IFIX
STRING
INTEGER
[TYPE]
Unbound integer. Uses integer
.
Instances
BITS
INTEGER
COMPLEX
INTEGER
DEFAULT
INTEGER
DIVIDABLE
INTEGER
BIG-FLOAT
DIVIDABLE
INTEGER
CREAL
DIVIDABLE
INTEGER
DOUBLE-FLOAT
DIVIDABLE
INTEGER
FRACTION
DIVIDABLE
INTEGER
SINGLE-FLOAT
EQ
INTEGER
HASH
INTEGER
INTEGRAL
INTEGER
INTO
I16
INTEGER
INTO
I32
INTEGER
INTO
I64
INTEGER
INTO
I8
INTEGER
INTO
IFIX
INTEGER
INTO
INTEGER
BIG-FLOAT
INTO
INTEGER
CREAL
INTO
INTEGER
DYADIC
INTO
INTEGER
STRING
INTO
U16
INTEGER
INTO
U32
INTEGER
INTO
U64
INTEGER
INTO
U8
INTEGER
INTO
UFIX
INTEGER
NUM
INTEGER
ORD
INTEGER
QUANTIZABLE
INTEGER
RATIONAL
INTEGER
REAL
INTEGER
REMAINDER
INTEGER
RUNTIMEREPR
INTEGER
TRYINTO
INTEGER
DOUBLE-FLOAT
STRING
TRYINTO
INTEGER
I16
STRING
TRYINTO
INTEGER
I32
STRING
TRYINTO
INTEGER
I64
STRING
TRYINTO
INTEGER
I8
STRING
TRYINTO
INTEGER
IFIX
STRING
TRYINTO
INTEGER
SINGLE-FLOAT
STRING
TRYINTO
INTEGER
U16
STRING
TRYINTO
INTEGER
U32
STRING
TRYINTO
INTEGER
U64
STRING
TRYINTO
INTEGER
U8
STRING
TRYINTO
INTEGER
UFIX
STRING
TRYINTO
STRING
INTEGER
STRING
LIST
[TYPE]
Homogeneous list of objects represented as a Common Lisp list
.
Instances
ALTERNATIVE
LIST
APPLICATIVE
LIST
DEFAULT (
LIST
:A)EQ :A ⇒ EQ (
LIST
:A)FOLDABLE
LIST
FROMITERATOR (
LIST
:A) :AFUNCTOR
LIST
HASH :A ⇒ HASH (
LIST
:A)INTO (
LIST
:A) (VECTOR
:A)INTO (
LIST
CHAR
)STRING
INTO (
OPTIONAL
:A) (LIST
:A)INTO (
SEQ
:A) (LIST
:A)INTO (
VECTOR
:A) (LIST
:A)INTO
STRING
(LIST
CHAR
)INTOITERATOR (
LIST
:A) :AISO (
LIST
CHAR
)STRING
ISO (
VECTOR
:A) (LIST
:A)MONAD
LIST
MONOID (
LIST
:A)ORD :A ⇒ ORD (
LIST
:A)RUNTIMEREPR (
LIST
:A)SEMIGROUP (
LIST
:A)TRAVERSABLE
LIST
SINGLE-FLOAT
[TYPE]
Single precision floating point number. Uses single-float
.
Instances
COMPLEX
SINGLE-FLOAT
DEFAULT
SINGLE-FLOAT
DIVIDABLE
INTEGER
SINGLE-FLOAT
ELEMENTARY
SINGLE-FLOAT
EQ
SINGLE-FLOAT
EXPONENTIABLE
SINGLE-FLOAT
HASH
SINGLE-FLOAT
INTO
I16
SINGLE-FLOAT
INTO
I8
SINGLE-FLOAT
INTO
SINGLE-FLOAT
BIG-FLOAT
INTO
SINGLE-FLOAT
CREAL
INTO
SINGLE-FLOAT
STRING
INTO
U16
SINGLE-FLOAT
INTO
U8
SINGLE-FLOAT
NUM
SINGLE-FLOAT
ORD
SINGLE-FLOAT
POLAR
SINGLE-FLOAT
QUANTIZABLE
SINGLE-FLOAT
RADICAL
SINGLE-FLOAT
RATIONAL
SINGLE-FLOAT
REAL
SINGLE-FLOAT
RECIPROCABLE
SINGLE-FLOAT
RUNTIMEREPR
SINGLE-FLOAT
TRANSFINITE
SINGLE-FLOAT
TRIGONOMETRIC
SINGLE-FLOAT
TRYINTO
I32
SINGLE-FLOAT
STRING
TRYINTO
I64
SINGLE-FLOAT
STRING
TRYINTO
IFIX
SINGLE-FLOAT
STRING
TRYINTO
INTEGER
SINGLE-FLOAT
STRING
TRYINTO
SINGLE-FLOAT
FRACTION
STRING
TRYINTO
U32
SINGLE-FLOAT
STRING
TRYINTO
U64
SINGLE-FLOAT
STRING
TRYINTO
UFIX
SINGLE-FLOAT
STRING
STRING
[TYPE]
String of characters represented by Common Lisp string
.
Instances
DEFAULT
STRING
EQ
STRING
FROMITERATOR
STRING
CHAR
HASH
STRING
INTO (
LIST
CHAR
)STRING
INTO :A
STRING
⇒ INTO (CELL
:A)STRING
INTO
CHAR
STRING
INTO
DOUBLE-FLOAT
STRING
INTO
FRACTION
STRING
INTO
I16
STRING
INTO
I32
STRING
INTO
I64
STRING
INTO
I8
STRING
INTO
IFIX
STRING
INTO
INTEGER
STRING
INTO
PATHNAME
STRING
INTO
SINGLE-FLOAT
STRING
INTO
STRING
(LIST
CHAR
)INTO
STRING
PATHNAME
INTO
U16
STRING
INTO
U32
STRING
INTO
U64
STRING
INTO
U8
STRING
INTO
UFIX
STRING
INTOITERATOR
STRING
CHAR
ISO (
LIST
CHAR
)STRING
MONOID
STRING
ORD
STRING
RUNTIMEREPR
STRING
SEMIGROUP
STRING
SIGNALABLE
STRING
TRYINTO
DOUBLE-FLOAT
FRACTION
STRING
TRYINTO
I16
I8
STRING
TRYINTO
I16
U16
STRING
TRYINTO
I16
U32
STRING
TRYINTO
I16
U64
STRING
TRYINTO
I16
U8
STRING
TRYINTO
I16
UFIX
STRING
TRYINTO
I32
I16
STRING
TRYINTO
I32
I8
STRING
TRYINTO
I32
SINGLE-FLOAT
STRING
TRYINTO
I32
U16
STRING
TRYINTO
I32
U32
STRING
TRYINTO
I32
U64
STRING
TRYINTO
I32
U8
STRING
TRYINTO
I32
UFIX
STRING
TRYINTO
I64
DOUBLE-FLOAT
STRING
TRYINTO
I64
I16
STRING
TRYINTO
I64
I32
STRING
TRYINTO
I64
I8
STRING
TRYINTO
I64
IFIX
STRING
TRYINTO
I64
SINGLE-FLOAT
STRING
TRYINTO
I64
U16
STRING
TRYINTO
I64
U32
STRING
TRYINTO
I64
U64
STRING
TRYINTO
I64
U8
STRING
TRYINTO
I64
UFIX
STRING
TRYINTO
I8
U16
STRING
TRYINTO
I8
U32
STRING
TRYINTO
I8
U64
STRING
TRYINTO
I8
U8
STRING
TRYINTO
I8
UFIX
STRING
TRYINTO
IFIX
DOUBLE-FLOAT
STRING
TRYINTO
IFIX
I16
STRING
TRYINTO
IFIX
I32
STRING
TRYINTO
IFIX
I8
STRING
TRYINTO
IFIX
SINGLE-FLOAT
STRING
TRYINTO
IFIX
U16
STRING
TRYINTO
IFIX
U32
STRING
TRYINTO
IFIX
U64
STRING
TRYINTO
IFIX
U8
STRING
TRYINTO
IFIX
UFIX
STRING
TRYINTO
INTEGER
DOUBLE-FLOAT
STRING
TRYINTO
INTEGER
I16
STRING
TRYINTO
INTEGER
I32
STRING
TRYINTO
INTEGER
I64
STRING
TRYINTO
INTEGER
I8
STRING
TRYINTO
INTEGER
IFIX
STRING
TRYINTO
INTEGER
SINGLE-FLOAT
STRING
TRYINTO
INTEGER
U16
STRING
TRYINTO
INTEGER
U32
STRING
TRYINTO
INTEGER
U64
STRING
TRYINTO
INTEGER
U8
STRING
TRYINTO
INTEGER
UFIX
STRING
TRYINTO
SINGLE-FLOAT
FRACTION
STRING
TRYINTO
STRING
INTEGER
STRING
TRYINTO
U16
I16
STRING
TRYINTO
U16
I8
STRING
TRYINTO
U16
U8
STRING
TRYINTO
U32
I16
STRING
TRYINTO
U32
I32
STRING
TRYINTO
U32
I8
STRING
TRYINTO
U32
SINGLE-FLOAT
STRING
TRYINTO
U32
U16
STRING
TRYINTO
U32
U8
STRING
TRYINTO
U64
DOUBLE-FLOAT
STRING
TRYINTO
U64
I16
STRING
TRYINTO
U64
I32
STRING
TRYINTO
U64
I64
STRING
TRYINTO
U64
I8
STRING
TRYINTO
U64
IFIX
STRING
TRYINTO
U64
SINGLE-FLOAT
STRING
TRYINTO
U64
U16
STRING
TRYINTO
U64
U32
STRING
TRYINTO
U64
U8
STRING
TRYINTO
U64
UFIX
STRING
TRYINTO
U8
I8
STRING
TRYINTO
UFIX
DOUBLE-FLOAT
STRING
TRYINTO
UFIX
I16
STRING
TRYINTO
UFIX
I32
STRING
TRYINTO
UFIX
I8
STRING
TRYINTO
UFIX
SINGLE-FLOAT
STRING
TRYINTO
UFIX
U16
STRING
TRYINTO
UFIX
U32
STRING
TRYINTO
UFIX
U8
STRING
U16
[TYPE]
Unsigned 16-bit integer capable of storing values in [0, 65535]
. Uses (unsigned-byte 16)
.
Instances
%FILEBYTE
U16
BITS
U16
BOUNDED
U16
COMPLEX
U16
DEFAULT
U16
EQ
U16
FILE
U16
HASH
U16
INTEGRAL
U16
INTO
U16
CREAL
INTO
U16
DOUBLE-FLOAT
INTO
U16
I32
INTO
U16
I64
INTO
U16
IFIX
INTO
U16
INTEGER
INTO
U16
SINGLE-FLOAT
INTO
U16
STRING
INTO
U16
U32
INTO
U16
U64
INTO
U16
UFIX
INTO
U8
U16
NUM
U16
ORD
U16
REMAINDER
U16
RUNTIMEREPR
U16
TRYINTO
I16
U16
STRING
TRYINTO
I32
U16
STRING
TRYINTO
I64
U16
STRING
TRYINTO
I8
U16
STRING
TRYINTO
IFIX
U16
STRING
TRYINTO
INTEGER
U16
STRING
TRYINTO
U16
I16
STRING
TRYINTO
U16
I8
STRING
TRYINTO
U16
U8
STRING
TRYINTO
U32
U16
STRING
TRYINTO
U64
U16
STRING
TRYINTO
UFIX
U16
STRING
U32
[TYPE]
Unsigned 32-bit integer capable of storing values in [0, 4294967295]
. Uses (unsigned-byte 32)
.
Instances
%FILEBYTE
U32
BITS
U32
BOUNDED
U32
COMPLEX
U32
DEFAULT
U32
EQ
U32
FILE
U32
HASH
U32
INTEGRAL
U32
INTO
U16
U32
INTO
U32
CREAL
INTO
U32
DOUBLE-FLOAT
INTO
U32
I64
INTO
U32
IFIX
INTO
U32
INTEGER
INTO
U32
STRING
INTO
U32
U64
INTO
U32
UFIX
INTO
U8
U32
NUM
U32
ORD
U32
QUANTIZABLE
U32
RATIONAL
U32
REAL
U32
REMAINDER
U32
RUNTIMEREPR
U32
TRYINTO
I16
U32
STRING
TRYINTO
I32
U32
STRING
TRYINTO
I64
U32
STRING
TRYINTO
I8
U32
STRING
TRYINTO
IFIX
U32
STRING
TRYINTO
INTEGER
U32
STRING
TRYINTO
U32
I16
STRING
TRYINTO
U32
I32
STRING
TRYINTO
U32
I8
STRING
TRYINTO
U32
SINGLE-FLOAT
STRING
TRYINTO
U32
U16
STRING
TRYINTO
U32
U8
STRING
TRYINTO
U64
U32
STRING
TRYINTO
UFIX
U32
STRING
U64
[TYPE]
Unsigned 64-bit integer capable of storing values in [0, 18446744073709551615]
. Uses (unsigned-byte 64)
.
Instances
%FILEBYTE
U64
BITS
U64
BOUNDED
U64
COMPLEX
U64
DEFAULT
U64
EQ
U64
FILE
U64
HASH
U64
INTEGRAL
U64
INTO
U16
U64
INTO
U32
U64
INTO
U64
CREAL
INTO
U64
INTEGER
INTO
U64
STRING
INTO
U8
U64
INTO
UFIX
U64
NUM
U64
ORD
U64
QUANTIZABLE
U64
RATIONAL
U64
REAL
U64
REMAINDER
U64
RUNTIMEREPR
U64
TRYINTO
I16
U64
STRING
TRYINTO
I32
U64
STRING
TRYINTO
I64
U64
STRING
TRYINTO
I8
U64
STRING
TRYINTO
IFIX
U64
STRING
TRYINTO
INTEGER
U64
STRING
TRYINTO
U64
DOUBLE-FLOAT
STRING
TRYINTO
U64
I16
STRING
TRYINTO
U64
I32
STRING
TRYINTO
U64
I64
STRING
TRYINTO
U64
I8
STRING
TRYINTO
U64
IFIX
STRING
TRYINTO
U64
SINGLE-FLOAT
STRING
TRYINTO
U64
U16
STRING
TRYINTO
U64
U32
STRING
TRYINTO
U64
U8
STRING
TRYINTO
U64
UFIX
STRING
U8
[TYPE]
Unsigned 8-bit integer capable of storing values in [0, 255]
. Uses (unsigned-byte 8)
.
Instances
%FILEBYTE
U8
BITS
U8
BOUNDED
U8
COMPLEX
U8
DEFAULT
U8
EQ
U8
FILE
U8
HASH
U8
INTEGRAL
U8
INTO
U8
CREAL
INTO
U8
DOUBLE-FLOAT
INTO
U8
I16
INTO
U8
I32
INTO
U8
I64
INTO
U8
IFIX
INTO
U8
INTEGER
INTO
U8
SINGLE-FLOAT
INTO
U8
STRING
INTO
U8
U16
INTO
U8
U32
INTO
U8
U64
INTO
U8
UFIX
NUM
U8
ORD
U8
QUANTIZABLE
U8
RATIONAL
U8
REAL
U8
REMAINDER
U8
RUNTIMEREPR
U8
TRYINTO
I16
U8
STRING
TRYINTO
I32
U8
STRING
TRYINTO
I64
U8
STRING
TRYINTO
I8
U8
STRING
TRYINTO
IFIX
U8
STRING
TRYINTO
INTEGER
U8
STRING
TRYINTO
U16
U8
STRING
TRYINTO
U32
U8
STRING
TRYINTO
U64
U8
STRING
TRYINTO
U8
I8
STRING
TRYINTO
UFIX
U8
STRING
UFIX
[TYPE]
Non-allocating tagged non-negative integer; range is platform-dependent. Uses (and fixnum unsigned-byte)
.
Instances
%FILEBYTE
UFIX
BITS
UFIX
BOUNDED
UFIX
COMPLEX
UFIX
DEFAULT
UFIX
EQ
UFIX
FILE
UFIX
HASH
UFIX
INTEGRAL
UFIX
INTO
U16
UFIX
INTO
U32
UFIX
INTO
U8
UFIX
INTO
UFIX
CREAL
INTO
UFIX
I64
INTO
UFIX
IFIX
INTO
UFIX
INTEGER
INTO
UFIX
STRING
INTO
UFIX
U64
NUM
UFIX
ORD
UFIX
QUANTIZABLE
UFIX
RATIONAL
UFIX
REAL
UFIX
REMAINDER
UFIX
RUNTIMEREPR
UFIX
TRYINTO
I16
UFIX
STRING
TRYINTO
I32
UFIX
STRING
TRYINTO
I64
UFIX
STRING
TRYINTO
I8
UFIX
STRING
TRYINTO
IFIX
UFIX
STRING
TRYINTO
INTEGER
UFIX
STRING
TRYINTO
U64
UFIX
STRING
TRYINTO
UFIX
DOUBLE-FLOAT
STRING
TRYINTO
UFIX
I16
STRING
TRYINTO
UFIX
I32
STRING
TRYINTO
UFIX
I8
STRING
TRYINTO
UFIX
SINGLE-FLOAT
STRING
TRYINTO
UFIX
U16
STRING
TRYINTO
UFIX
U32
STRING
TRYINTO
UFIX
U8
STRING
UNIT
[TYPE]
Instances
EQ
UNIT
INTOITERATOR
UNIT
:A
VOID
[TYPE]
Instances
Values
(CONS X XS)
[FUNCTION]
∀ :A. (:A → (
LIST
:A) → (LIST
:A))
FALSE
[VALUE]
NIL
[VALUE]
∀ :A. (
LIST
:A)
TRUE
[VALUE]
UNIT
[VALUE]
Package COALTON-LIBRARY/BIG-FLOAT
Types
BIG-FLOAT
[TYPE]
An arbitrary (but fixed) precision floating point number.
Instances
COMPLEX
BIG-FLOAT
DIVIDABLE
INTEGER
BIG-FLOAT
ELEMENTARY
BIG-FLOAT
EQ
BIG-FLOAT
EXPONENTIABLE
BIG-FLOAT
INTO
DOUBLE-FLOAT
BIG-FLOAT
INTO
FRACTION
BIG-FLOAT
INTO
INTEGER
BIG-FLOAT
INTO
SINGLE-FLOAT
BIG-FLOAT
NUM
BIG-FLOAT
ORD
BIG-FLOAT
POLAR
BIG-FLOAT
QUANTIZABLE
BIG-FLOAT
RADICAL
BIG-FLOAT
RATIONAL
BIG-FLOAT
REAL
BIG-FLOAT
RECIPROCABLE
BIG-FLOAT
RUNTIMEREPR
BIG-FLOAT
TRANSFINITE
BIG-FLOAT
TRIGONOMETRIC
BIG-FLOAT
ROUNDINGMODE
[TYPE]
Instances
Values
(BF-EE _)
[FUNCTION]
∀ :A. (:A →
BIG-FLOAT
)
Return the value of ee = exp(1) to the currently set precision.
(BF-PI _)
[FUNCTION]
∀ :A. (:A →
BIG-FLOAT
)
Return the value of pi to the currently set precision.
(GET-PRECISION _)
[FUNCTION]
Get the current precision of Big-Float arithmetic.
(GET-ROUNDING-MODE _)
[FUNCTION]
(
UNIT
→ ROUNDINGMODE
)
Get the current rounding-mode of Big-Float arithmetic.
(SET-PRECISION! PREC-BITS)
[FUNCTION]
Set the precision of Big-Float arithmetic to PREC-BITS bits.
(SET-ROUNDING-MODE! R)
[FUNCTION]
(
ROUNDINGMODE
→ UNIT
)
Set the global rounding mode for Big-Float operations.
(WITH-PRECISION PREC-BITS F)
[FUNCTION]
∀ :A. (
UFIX
→ (UNIT
→ :A) → :A)
Call F with a temporary Big-Float precision PREC-BITS.
(WITH-PRECISION-ROUNDING PREC-BITS RND F)
[FUNCTION]
∀ :A. (
UFIX
→ ROUNDINGMODE
→ (UNIT
→ :A) → :A)
Call F with a temporary Big-Float PREC-BITS precision and RND rounding-mode.
(WITH-ROUNDING RND F)
[FUNCTION]
∀ :A. (
ROUNDINGMODE
→ (UNIT
→ :A) → :A)
Call F with a temporary Big-Float rounding-mode RND.
RNDA
[VALUE]
RouND Away from zero.
RNDD
[VALUE]
RouND Down, toward negative infinity.
RNDF
[VALUE]
Faithful rounding (experimental).
RNDN
[VALUE]
RouND to Nearest, with the even rounding rule.
RNDNA
[VALUE]
RouND to Nearest Away.
RNDU
[VALUE]
RouND Up, toward positive infinity.
RNDZ
[VALUE]
RouND toward Zero.
Package COALTON-LIBRARY/BITS
Classes
BITS
[CLASS]
Operations on the bits of twos-complement integers
Methods:
AND :: (:A → :A → :A)
The bitwise logicaland
of two integersOR :: (:A → :A → :A)
The bitwise logicalor
of two integersXOR :: (:A → :A → :A)
The bitwise logical exclusiveor
of two integersNOT :: (:A → :A)
The bitwise logicalnot
of two integersSHIFT :: (
INTEGER
→ :A → :A)
The arithmetic left-shift of an integer by an integer number of bits
Instances
Values
(DPB NEWBYTE SIZE POSITION BITSTRING)
[FUNCTION]
∀ :A. BITS :A ⇒ (:A →
UFIX
→ UFIX
→ :A → :A)
Deposits a byte newbyte
of size size
into a bitstring bitstring
at a position position
.
(LDB SIZE POSITION BITSTRING)
[FUNCTION]
∀ :A. BITS :A ⇒ (
UFIX
→ UFIX
→ :A → :A)
Deposits a byte of size size
into a bitstring at a position position
.
Package COALTON-LIBRARY/BUILTIN
Values
(BOOLEAN-AND X Y)
[FUNCTION]
Are both x
and y
true? Note that this is a function which means both x
and y
will be evaluated. Use the and
macro for short-circuiting behavior.
(BOOLEAN-NOT X)
[FUNCTION]
The logical negation of x
. Is x
false?
(BOOLEAN-OR X Y)
[FUNCTION]
Is either x
or y
true? Note that this is a function which means both x
and y
will be evaluated. Use the or
macro for short-circuiting behavior.
(BOOLEAN-XOR X Y)
[FUNCTION]
Are x
or y
true, but not both?
(NOT)
[FUNCTION]
Synonym for boolean-not
.
(UNDEFINED _)
[FUNCTION]
∀ :A :B. (:A → :B)
A function which can be used in place of any value, throwing an error at runtime.
(XOR)
[FUNCTION]
Synonym for boolean-xor
.
Package COALTON-LIBRARY/CELL
Types
CELL
[TYPE]
Internally mutable cell
Instances
Values
(DECREMENT! CEL)
[FUNCTION]
∀ :A. NUM :A ⇒ ((
CELL
:A) → :A)
Subtract one from the contents of CEL, storing and returning the new value
(INCREMENT! CEL)
[FUNCTION]
∀ :A. NUM :A ⇒ ((
CELL
:A) → :A)
Add one to the contents of CEL, storing and returning the new value
(NEW DATA)
[FUNCTION]
∀ :A. (:A → (
CELL
:A))
Create a new mutable cell
(POP! CEL)
[FUNCTION]
∀ :A. ((
CELL
(LIST
:A)) → (OPTIONAL
:A))
Remove and return the first element of the list in CEL.
(PUSH! CEL NEW-ELT)
[FUNCTION]
∀ :A. ((
CELL
(LIST
:A)) → :A → (LIST
:A))
Push NEW-ELT onto the start of the list in CEL.
(READ CEL)
[FUNCTION]
∀ :A. ((
CELL
:A) → :A)
Read the value of a mutable cell
(SWAP! CEL DATA)
[FUNCTION]
∀ :A. ((
CELL
:A) → :A → :A)
Replace the value of a mutable cell with a new value, then return the old value
(UPDATE! F CEL)
[FUNCTION]
∀ :A. ((:A → :A) → (
CELL
:A) → :A)
Apply F to the contents of CEL, storing and returning the result
(UPDATE-SWAP! F CEL)
[FUNCTION]
∀ :A. ((:A → :A) → (
CELL
:A) → :A)
Apply F to the contents of CEL, swapping the result for the old value
(WRITE! CEL DATA)
[FUNCTION]
∀ :A. ((
CELL
:A) → :A → :A)
Set the value of a mutable cell, returning the new value
Package COALTON-LIBRARY/CHAR
Values
(ALPHA? C)
[FUNCTION]
Is C an alphabetic character?
(ASCII-ALPHA? C)
[FUNCTION]
Is C an ASCII alphabetic character?
(ASCII-ALPHANUMERIC? C)
[FUNCTION]
Is C an ASCII alphanumeric character?
(ASCII-DIGIT? C)
[FUNCTION]
Is C an ASCII digit character?
(ASCII-LOWERCASE? C)
[FUNCTION]
Is C an ASCII lowercase character?
(ASCII-UPPERCASE? C)
[FUNCTION]
Is C an ASCII uppercase character?
(CHAR-CODE CHAR)
[FUNCTION]
Convert a character to its ASCII representation.
(CODE-CHAR CODE)
[FUNCTION]
Convert a number to its ASCII character, returning None on failure.
(DIGIT? C)
[FUNCTION]
Is C a digit character?
(DOWNCASE C)
[FUNCTION]
Returns the downcased version of C, returning C when there is none.
(LOWERCASE? C)
[FUNCTION]
Is C a lowercase character?
(RANGE START END)
[FUNCTION]
(
CHAR
→ CHAR
→ (ITERATOR
CHAR
))
An inclusive range of characters from START to END by cl:char-code.
(UPCASE C)
[FUNCTION]
Returns the upcased version of C, returning C when there is none.
(UPPERCASE? C)
[FUNCTION]
Is C an uppercase character?
Package COALTON-LIBRARY/CLASSES
Types
OPTIONAL
[TYPE]
Represents something that may not have a value.
Instances
ALTERNATIVE
OPTIONAL
APPLICATIVE
OPTIONAL
DEFAULT (
OPTIONAL
:A)EQ :A ⇒ EQ (
OPTIONAL
:A)FROMITERATOR :A :B ⇒ FROMITERATOR (
OPTIONAL
:A) (OPTIONAL
:B)FUNCTOR
OPTIONAL
INTO (
OPTIONAL
:A) (LIST
:A)INTO (
OPTIONAL
:A) (RESULT
UNIT
:A)INTO (
RESULT
:A :B) (OPTIONAL
:B)INTOITERATOR (
OPTIONAL
:A) :AISO (
RESULT
UNIT
:A) (OPTIONAL
:A)MONAD
OPTIONAL
MONADFAIL
OPTIONAL
MONOID :A ⇒ MONOID (
OPTIONAL
:A)NUM :A ⇒ NUM (
OPTIONAL
:A)ORD :A ⇒ ORD (
OPTIONAL
:A)RUNTIMEREPR (
OPTIONAL
:A)SEMIGROUP :A ⇒ SEMIGROUP (
OPTIONAL
:A)UNWRAPPABLE
OPTIONAL
ORD
[TYPE]
The result of an ordered comparison.
RESULT
[TYPE]
Represents something that may have failed.
Instances
(EQ :A) (EQ :B) ⇒ EQ (
RESULT
:A :B)(ORD :A) (ORD :B) ⇒ ORD (
RESULT
:A :B)APPLICATIVE (
RESULT
:A)BIFUNCTOR
RESULT
FROMITERATOR :A :B ⇒ FROMITERATOR (
RESULT
:C :A) (RESULT
:C :B)FUNCTOR (
RESULT
:A)INTO (
OPTIONAL
:A) (RESULT
UNIT
:A)INTO (
RESULT
:A :B) (OPTIONAL
:B)INTOITERATOR (
RESULT
:A :B) :BISO (
RESULT
UNIT
:A) (OPTIONAL
:A)MONAD (
RESULT
:A)MONOID :A ⇒ MONOID (
RESULT
:B :A)RUNTIMEREPR (
RESULT
:A :B)SEMIGROUP :A ⇒ SEMIGROUP (
RESULT
:B :A)UNWRAPPABLE (
RESULT
:A)
Structs
TUPLE :A :B
[STRUCT]
FIRST :: :A
SECOND :: :B
A heterogeneous collection of items.
Instances
(DEFAULT :A) (DEFAULT :B) ⇒ DEFAULT (
TUPLE
:A :B)(EQ :A) (EQ :B) ⇒ EQ (
TUPLE
:A :B)(HASH :A) (HASH :B) ⇒ HASH (
TUPLE
:A :B)(ORD :A) (ORD :B) ⇒ ORD (
TUPLE
:A :B)BIFUNCTOR
TUPLE
HASH :A ⇒ FROMITERATOR (
HASHTABLE
:A :B) (TUPLE
:A :B)INTO (
MAPPAIR
:A :B) (TUPLE
:A :B)INTO (
TUPLE
:A :B) (TUPLE
:B :A)INTOITERATOR (
HASHTABLE
:A :B) (TUPLE
:A :B)INTOITERATOR (
MAP
:A :B) (TUPLE
:A :B)ISO (
TUPLE
:A :B) (TUPLE
:B :A)ORD :A ⇒ FROMITERATOR (
MAP
:A :B) (TUPLE
:A :B)RUNTIMEREPR (
TUPLE
:A :B)
Classes
ALTERNATIVE
[CLASS]
APPLICATIVE :A ⇒ ALTERNATIVE :A
Types which are monoids on applicative functors.
Methods:
ALT :: ((:A :B) → (:A :B) → (:A :B))
EMPTY :: (:A :C)
Instances
APPLICATIVE
[CLASS]
FUNCTOR :A ⇒ APPLICATIVE :A
Types which are a functor which can embed pure expressions and sequence operations.
Methods:
PURE :: (:A → (:B :A))
LIFTA2 :: ((:C → :D → :E) → (:B :C) → (:B :D) → (:B :E))
Instances
FUNCTOR :A ⇒ APPLICATIVE (
FREE
:A)APPLICATIVE (
ST
:A)APPLICATIVE
LIST
APPLICATIVE (
RESULT
:A)APPLICATIVE
OPTIONAL
APPLICATIVE
CELL
BIFUNCTOR
[CLASS]
BIFUNCTOR :A
Types which take two type arguments and are functors on both.
Methods:
BIMAP :: ((:A → :B) → (:C → :D) → ((:E :A) :C) → ((:E :B) :D))
DEFAULT
[CLASS]
DEFAULT :A
Types which have default values.
Methods:
DEFAULT :: (
UNIT
→ :A)
Instances
RUNTIMEREPR :A ⇒ DEFAULT (
SEQ
:A)DEFAULT (
QUEUE
:A)HASH :A ⇒ DEFAULT (
HASHTABLE
:A :B)DEFAULT
STRING
DEFAULT (
VECTOR
:A)DEFAULT (
LIST
:A)DEFAULT (
OPTIONAL
:A)(DEFAULT :A) (DEFAULT :B) (DEFAULT :C) (DEFAULT :D) (DEFAULT :E) ⇒ DEFAULT (
TUPLE5
:A :B :C :D :E)(DEFAULT :A) (DEFAULT :B) (DEFAULT :C) (DEFAULT :D) ⇒ DEFAULT (
TUPLE4
:A :B :C :D)(DEFAULT :A) (DEFAULT :B) (DEFAULT :C) ⇒ DEFAULT (
TUPLE3
:A :B :C)(DEFAULT :A) (DEFAULT :B) ⇒ DEFAULT (
TUPLE
:A :B)DEFAULT :A ⇒ DEFAULT (
CELL
:A)DEFAULT
SINGLE-FLOAT
DEFAULT
DOUBLE-FLOAT
DEFAULT
INTEGER
DEFAULT
UFIX
DEFAULT
IFIX
DEFAULT
U64
DEFAULT
U32
DEFAULT
U16
DEFAULT
I64
DEFAULT
I32
DEFAULT
I16
DEFAULT
U8
DEFAULT
I8
DEFAULT
BOOLEAN
DEFAULT
HASH
EQ
[CLASS]
EQ :A
Types which have equality defined.
Methods:
== :: (:A → :A →
BOOLEAN
)
Instances
EQ
CREAL
EQ
BIG-FLOAT
EQ
PATHNAME
EQ :A ⇒ EQ (
SEQ
:A)(EQ :A) (EQ :B) ⇒ EQ (
MAP
:A :B)EQ :A ⇒ EQ (
MAPPAIR
:A :B)EQ :A ⇒ EQ (
TREE
:A)EQ
COLOR
EQ :A ⇒ EQ (
QUEUE
:A)(HASH :A) (EQ :B) ⇒ EQ (
HASHTABLE
:A :B)EQ :A ⇒ EQ (
SLICE
:A)EQ
STRING
EQ
CHAR
EQ :A ⇒ EQ (
VECTOR
:A)EQ :A ⇒ EQ (
LIST
:A)(EQ :A) (EQ :B) ⇒ EQ (
RESULT
:A :B)EQ :A ⇒ EQ (
OPTIONAL
:A)(EQ :A) (EQ :B) (EQ :C) (EQ :D) (EQ :E) ⇒ EQ (
TUPLE5
:A :B :C :D :E)(EQ :A) (EQ :B) (EQ :C) (EQ :D) ⇒ EQ (
TUPLE4
:A :B :C :D)(EQ :A) (EQ :B) (EQ :C) ⇒ EQ (
TUPLE3
:A :B :C)(EQ :A) (EQ :B) ⇒ EQ (
TUPLE
:A :B)EQ :A ⇒ EQ (
CELL
:A)EQ :A ⇒ EQ (
DUAL
:A)
Note: Eq only compares the primal component.EQ
DYADIC
COMPLEX :A ⇒ EQ (
COMPLEX
:A)EQ
FRACTION
EQ
DOUBLE-FLOAT
EQ
SINGLE-FLOAT
EQ
U64
EQ
I64
EQ
U32
EQ
I32
EQ
U16
EQ
I16
EQ
U8
EQ
I8
EQ
UFIX
EQ
IFIX
EQ
INTEGER
EQ
BOOLEAN
EQ
HASH
EQ
ORD
EQ
UNIT
EQ
LISPTYPE
FOLDABLE
[CLASS]
FOLDABLE :A
Types which can be folded into a single element.
Methods:
FOLD :: ((:A → :B → :A) → :A → (:C :B) → :A)
A left tail-recursive fold.FOLDR :: ((:D → :E → :E) → :E → (:C :D) → :E)
A right non-tail-recursive fold.
Instances
FUNCTOR
[CLASS]
FUNCTOR :A
Types which can map an inner type where the mapping adheres to the identity and composition laws.
Methods:
MAP :: ((:A → :B) → (:C :A) → (:C :B))
Instances
INTO
[CLASS]
INTO :A :B
INTO
imples every element of :a
can be represented by an element of :b
. This conversion might not be bijective (i.e., there may be elements in :b
that don’t correspond to any in :a
).
Methods:
INTO :: (:A → :B)
Instances
INTO
I8
CREAL
INTO
U8
CREAL
INTO
I16
CREAL
INTO
U16
CREAL
INTO
I32
CREAL
INTO
U32
CREAL
INTO
I64
CREAL
INTO
U64
CREAL
INTO
IFIX
CREAL
INTO
UFIX
CREAL
INTO
INTEGER
CREAL
INTO
FRACTION
CREAL
INTO
DOUBLE-FLOAT
CREAL
INTO
SINGLE-FLOAT
CREAL
(COMPLEX :A) (INTO :A
CREAL
) ⇒ INTO (COMPLEX
:A) (COMPLEX
CREAL
)INTO
DOUBLE-FLOAT
BIG-FLOAT
INTO
SINGLE-FLOAT
BIG-FLOAT
INTO
FRACTION
BIG-FLOAT
INTO
INTEGER
BIG-FLOAT
INTO
PATHNAME
STRING
INTO
STRING
PATHNAME
INTO (
SEQ
:A) (VECTOR
:A)INTO (
SEQ
:A) (LIST
:A)(FOLDABLE :A) (RUNTIMEREPR :B) ⇒ INTO (:A :B) (
SEQ
:B)INTO (
MAPPAIR
:A :B) (TUPLE
:A :B)INTO (
VECTOR
:A) (SLICE
:A)INTO (
SLICE
:A) (VECTOR
:A)INTO
DOUBLE-FLOAT
STRING
INTO
SINGLE-FLOAT
STRING
INTO
FRACTION
STRING
INTO
U64
STRING
INTO
I64
STRING
INTO
U32
STRING
INTO
I32
STRING
INTO
U16
STRING
INTO
I16
STRING
INTO
U8
STRING
INTO
I8
STRING
INTO
UFIX
STRING
INTO
IFIX
STRING
INTO
INTEGER
STRING
INTO (
LIST
CHAR
)STRING
INTO
CHAR
STRING
INTO
STRING
(LIST
CHAR
)INTO (
VECTOR
:A) (LIST
:A)INTO (
LIST
:A) (VECTOR
:A)INTO (
OPTIONAL
:A) (LIST
:A)INTO (
OPTIONAL
:A) (RESULT
UNIT
:A)INTO (
RESULT
:A :B) (OPTIONAL
:B)INTO (
TUPLE
:A :B) (TUPLE
:B :A)INTO :A
STRING
⇒ INTO (CELL
:A)STRING
INTO (
CELL
:A) :AINTO :A (
CELL
:A)INTO
INTEGER
DYADIC
INTO
DYADIC
FRACTION
COMPLEX :A ⇒ INTO :A (
COMPLEX
:A)INTO
I32
DOUBLE-FLOAT
INTO
U32
DOUBLE-FLOAT
INTO
I16
DOUBLE-FLOAT
INTO
U16
DOUBLE-FLOAT
INTO
I8
DOUBLE-FLOAT
INTO
U8
DOUBLE-FLOAT
INTO
I16
SINGLE-FLOAT
INTO
U16
SINGLE-FLOAT
INTO
I8
SINGLE-FLOAT
INTO
U8
SINGLE-FLOAT
INTO
IFIX
INTEGER
INTO
IFIX
I64
INTO
UFIX
INTEGER
INTO
UFIX
IFIX
INTO
UFIX
I64
INTO
UFIX
U64
INTO
I64
INTEGER
INTO
U64
INTEGER
INTO
I32
INTEGER
INTO
I32
IFIX
INTO
I32
I64
INTO
U32
INTEGER
INTO
U32
IFIX
INTO
U32
UFIX
INTO
U32
I64
INTO
U32
U64
INTO
I16
INTEGER
INTO
I16
IFIX
INTO
I16
I64
INTO
I16
I32
INTO
U16
INTEGER
INTO
U16
IFIX
INTO
U16
UFIX
INTO
U16
I64
INTO
U16
U64
INTO
U16
I32
INTO
U16
U32
INTO
I8
INTEGER
INTO
I8
IFIX
INTO
I8
I64
INTO
I8
I32
INTO
I8
I16
INTO
U8
INTEGER
INTO
U8
IFIX
INTO
U8
UFIX
INTO
U8
I64
INTO
U8
U64
INTO
U8
I32
INTO
U8
U32
INTO
U8
I16
INTO
U8
U16
INTO :A :A
ISO
[CLASS]
(INTO :A :B) (INTO :B :A) ⇒ ISO :A :B
Opting into this marker typeclass imples that the instances for (Into :a :b)
and (Into :b :a)
form a bijection.
Methods:
Instances
MONAD
[CLASS]
APPLICATIVE :A ⇒ MONAD :A
Types which are monads as defined in Haskell. See https://wiki.haskell.org/Monad for more information.
Methods:
>>= :: ((:A :B) → (:B → (:A :C)) → (:A :C))
MONADFAIL
[CLASS]
Methods:
FAIL :: (
STRING
→ (:A :B))
MONOID
[CLASS]
Types with an associative binary operation and identity defined.
Methods:
MEMPTY :: :A
Instances
NUM
[CLASS]
Types which have numeric operations defined.
Methods:
+ :: (:A → :A → :A)
- :: (:A → :A → :A)
* :: (:A → :A → :A)
FROMINT :: (
INTEGER
→ :A)
Instances
ORD
[CLASS]
Types whose values can be ordered.
Methods:
<=> :: (:A → :A →
ORD
)
Instances
ORD
CREAL
ORD
BIG-FLOAT
ORD
PATHNAME
ORD :A ⇒ ORD (
MAPPAIR
:A :B)ORD
STRING
ORD
CHAR
ORD :A ⇒ ORD (
LIST
:A)(ORD :A) (ORD :B) ⇒ ORD (
RESULT
:A :B)ORD :A ⇒ ORD (
OPTIONAL
:A)(ORD :A) (ORD :B) ⇒ ORD (
TUPLE
:A :B)ORD :A ⇒ ORD (
CELL
:A)ORD :A ⇒ ORD (
DUAL
:A)
Note: Ord only compares the primal component.ORD
DYADIC
ORD
FRACTION
ORD
DOUBLE-FLOAT
ORD
SINGLE-FLOAT
ORD
U64
ORD
I64
ORD
U32
ORD
I32
ORD
U16
ORD
I16
ORD
U8
ORD
I8
ORD
UFIX
ORD
IFIX
ORD
INTEGER
ORD
BOOLEAN
ORD
HASH
ORD
ORD
SEMIGROUP
[CLASS]
SEMIGROUP :A
Types with an associative binary operation defined.
Methods:
<> :: (:A → :A → :A)
Instances
SEMIGROUP
PATHNAME
RUNTIMEREPR :A ⇒ SEMIGROUP (
SEQ
:A)ORD :A ⇒ SEMIGROUP (
MAP
:A :B)ORD :A ⇒ SEMIGROUP (
TREE
:A)SEMIGROUP (
QUEUE
:A)SEMIGROUP
STRING
SEMIGROUP (
VECTOR
:A)SEMIGROUP (
LIST
:A)SEMIGROUP :A ⇒ SEMIGROUP (
RESULT
:B :A)SEMIGROUP :A ⇒ SEMIGROUP (
OPTIONAL
:A)SEMIGROUP :A ⇒ SEMIGROUP (
CELL
:A)SEMIGROUP
HASH
SIGNALABLE
[CLASS]
SIGNALABLE :A
Signals errors or warnings by calling their respective lisp conditions.
Methods:
ERROR :: (:A → :B)
Signal an error with a type-specific error string.
Instances
TRAVERSABLE
[CLASS]
TRAVERSABLE :A
Methods:
TRAVERSE :: APPLICATIVE :A ⇒ ((:B → (:A :C)) → (:D :B) → (:A (:D :C)))
Instances
TRAVERSABLE :A ⇒ TRAVERSABLE (
FREE
:A)TRAVERSABLE
LIST
TRYINTO
[CLASS]
TRYINTO :A :B :C
TRY-INTO
implies some elements of :a
can be represented exactly by an element of :b
, but sometimes not. If not, an error of type :c
is returned.
Methods:
TRYINTO :: (:A → (
RESULT
:B :C))
Instances
TRYINTO
STRING
INTEGER
STRING
TRYINTO
UFIX
DOUBLE-FLOAT
STRING
TRYINTO
IFIX
DOUBLE-FLOAT
STRING
TRYINTO
U64
DOUBLE-FLOAT
STRING
TRYINTO
I64
DOUBLE-FLOAT
STRING
TRYINTO
I32
SINGLE-FLOAT
STRING
TRYINTO
U32
SINGLE-FLOAT
STRING
TRYINTO
UFIX
SINGLE-FLOAT
STRING
TRYINTO
IFIX
SINGLE-FLOAT
STRING
TRYINTO
U64
SINGLE-FLOAT
STRING
TRYINTO
I64
SINGLE-FLOAT
STRING
TRYINTO
INTEGER
DOUBLE-FLOAT
STRING
TRYINTO
INTEGER
SINGLE-FLOAT
STRING
TRYINTO
INTEGER
IFIX
STRING
TRYINTO
INTEGER
UFIX
STRING
TRYINTO
INTEGER
I64
STRING
TRYINTO
INTEGER
U64
STRING
TRYINTO
INTEGER
I32
STRING
TRYINTO
INTEGER
U32
STRING
TRYINTO
INTEGER
I16
STRING
TRYINTO
INTEGER
U16
STRING
TRYINTO
INTEGER
I8
STRING
TRYINTO
INTEGER
U8
STRING
TRYINTO
IFIX
UFIX
STRING
TRYINTO
IFIX
U64
STRING
TRYINTO
IFIX
I32
STRING
TRYINTO
IFIX
U32
STRING
TRYINTO
IFIX
I16
STRING
TRYINTO
IFIX
U16
STRING
TRYINTO
IFIX
I8
STRING
TRYINTO
IFIX
U8
STRING
TRYINTO
UFIX
I32
STRING
TRYINTO
UFIX
U32
STRING
TRYINTO
UFIX
I16
STRING
TRYINTO
UFIX
U16
STRING
TRYINTO
UFIX
I8
STRING
TRYINTO
UFIX
U8
STRING
TRYINTO
I64
IFIX
STRING
TRYINTO
I64
UFIX
STRING
TRYINTO
I64
U64
STRING
TRYINTO
I64
I32
STRING
TRYINTO
I64
U32
STRING
TRYINTO
I64
I16
STRING
TRYINTO
I64
U16
STRING
TRYINTO
I64
I8
STRING
TRYINTO
I64
U8
STRING
TRYINTO
U64
IFIX
STRING
TRYINTO
U64
UFIX
STRING
TRYINTO
U64
I64
STRING
TRYINTO
U64
I32
STRING
TRYINTO
U64
U32
STRING
TRYINTO
U64
I16
STRING
TRYINTO
U64
U16
STRING
TRYINTO
U64
I8
STRING
TRYINTO
U64
U8
STRING
TRYINTO
I32
UFIX
STRING
TRYINTO
I32
U64
STRING
TRYINTO
I32
U32
STRING
TRYINTO
I32
I16
STRING
TRYINTO
I32
U16
STRING
TRYINTO
I32
I8
STRING
TRYINTO
I32
U8
STRING
TRYINTO
U32
I32
STRING
TRYINTO
U32
I16
STRING
TRYINTO
U32
U16
STRING
TRYINTO
U32
I8
STRING
TRYINTO
U32
U8
STRING
TRYINTO
I16
UFIX
STRING
TRYINTO
I16
U64
STRING
TRYINTO
I16
U32
STRING
TRYINTO
I16
U16
STRING
TRYINTO
I16
I8
STRING
TRYINTO
I16
U8
STRING
TRYINTO
U16
I16
STRING
TRYINTO
U16
I8
STRING
TRYINTO
U16
U8
STRING
TRYINTO
I8
UFIX
STRING
TRYINTO
I8
U64
STRING
TRYINTO
I8
U32
STRING
TRYINTO
I8
U16
STRING
TRYINTO
I8
U8
STRING
TRYINTO
U8
I8
STRING
TRYINTO
DOUBLE-FLOAT
FRACTION
STRING
TRYINTO
SINGLE-FLOAT
FRACTION
STRING
UNWRAPPABLE
[CLASS]
UNWRAPPABLE :A
Containers which can be unwrapped to get access to their contents.
(unwrap-or-else succeed fail container)
should invoke the succeed
continuation on the unwrapped contents of
container
when successful, or invoke the fail
continuation with no arguments (i.e., with Unit
as an argument)
when unable to unwrap a value.
The succeed
continuation will often, but not always, be the identity function. as-optional
passes Some
to
construct an Optional
.
Typical fail
continuations are:
- Return a default value, or
- Signal an error.
Methods:
UNWRAP-OR-ELSE :: ((:A → :B) → (
UNIT
→ :B) → (:C :A) → :B)
Instances
Values
(< X Y)
[FUNCTION]
∀ :A. ORD :A ⇒ (:A → :A →
BOOLEAN
)
Is x
less than y
?
(<= X Y)
[FUNCTION]
∀ :A. ORD :A ⇒ (:A → :A →
BOOLEAN
)
Is x
less than or equal to y
?
(> X Y)
[FUNCTION]
∀ :A. ORD :A ⇒ (:A → :A →
BOOLEAN
)
Is x
greater than y
?
(>= X Y)
[FUNCTION]
∀ :A. ORD :A ⇒ (:A → :A →
BOOLEAN
)
Is x
greater than or equal to y
?
(>> A B)
[FUNCTION]
∀ :A :B :C. MONAD :A ⇒ ((:A :B) → (:A :C) → (:A :C))
(AS-OPTIONAL CONTAINER)
[FUNCTION]
∀ :A :B. UNWRAPPABLE :A ⇒ ((:A :B) → (
OPTIONAL
:B))
Convert any Unwrappable container into an Optional
, constructing Some on a successful unwrap and None on a failed unwrap.
(DEFAULT? X)
[FUNCTION]
∀ :A. (DEFAULT :A) (EQ :A) ⇒ (:A →
BOOLEAN
)
Is x
the default item of its type?
(DEFAULTING-UNWRAP CONTAINER)
[FUNCTION]
∀ :A :B. (UNWRAPPABLE :A) (DEFAULT :B) ⇒ ((:A :B) → :B)
Unwrap an unwrappable
, returning (default)
of the wrapped type on failure.
(EXPECT REASON CONTAINER)
[FUNCTION]
∀ :A :B. UNWRAPPABLE :A ⇒ (
STRING
→ (:A :B) → :B)
Unwrap container
, signaling an error with the description reason
on failure.
(MAP-FST F B)
[FUNCTION]
∀ :A :B :C :D. BIFUNCTOR :C ⇒ ((:A → :B) → (:C :A :D) → (:C :B :D))
Map over the first argument of a Bifunctor
.
(MAP-SND F B)
[FUNCTION]
∀ :A :B :C :D. BIFUNCTOR :C ⇒ ((:A → :B) → (:C :D :A) → (:C :D :B))
Map over the second argument of a Bifunctor
.
(MAX X Y)
[FUNCTION]
∀ :A. ORD :A ⇒ (:A → :A → :A)
Returns the greater element of x
and y
.
(MCONCAT)
[FUNCTION]
∀ :A :B. (FOLDABLE :A) (MONOID :B) ⇒ ((:A :B) → :B)
Fold a container of monoids into a single element.
(MIN X Y)
[FUNCTION]
∀ :A. ORD :A ⇒ (:A → :A → :A)
Returns the lesser element of x
and y
.
(SEQUENCE)
[FUNCTION]
∀ :A :B :C. (TRAVERSABLE :A) (APPLICATIVE :B) ⇒ ((:A (:B :C)) → (:B (:A :C)))
(UNWRAP CONTAINER)
[FUNCTION]
∀ :A :B. UNWRAPPABLE :A ⇒ ((:A :B) → :B)
Unwrap container
, signaling an error on failure.
(WITH-DEFAULT DEFAULT CONTAINER)
[FUNCTION]
∀ :A :B. UNWRAPPABLE :B ⇒ (:A → (:B :A) → :A)
Unwrap container
, returning default
on failure.
Package COALTON-LIBRARY/COMPUTABLE-REALS
Types
CREAL
[TYPE]
Instances
COMPLEX
CREAL
DIVIDABLE
INTEGER
CREAL
ELEMENTARY
CREAL
EQ
CREAL
EXPONENTIABLE
CREAL
INTO
DOUBLE-FLOAT
CREAL
INTO
FRACTION
CREAL
INTO
I16
CREAL
INTO
I32
CREAL
INTO
I64
CREAL
INTO
I8
CREAL
INTO
IFIX
CREAL
INTO
INTEGER
CREAL
INTO
SINGLE-FLOAT
CREAL
INTO
U16
CREAL
INTO
U32
CREAL
INTO
U64
CREAL
INTO
U8
CREAL
INTO
UFIX
CREAL
NUM
CREAL
ORD
CREAL
POLAR
CREAL
QUANTIZABLE
CREAL
RADICAL
CREAL
REAL
CREAL
RECIPROCABLE
CREAL
RUNTIMEREPR
CREAL
TRIGONOMETRIC
CREAL
Values
(APPROX X K)
[FUNCTION]
Computes an approximation of the bits of a given Creal
. Specifically, given an object of type Creal
X
and a non-negative integer K
, return an integer A
with
`|A*2^(-k) - X| <= 2^(-K)`.
See rational
or rationalize
to produce a rational approximation of Creal
.
(COMPARISON-THRESHOLD _)
[FUNCTION]
∀ :A. (:A →
UFIX
)
Returns the current Creal
comparison threshold measured as a number of bits after the ‘decimal’ point.
This threshold is used to ensure Eq
and Ord
instances terminate. (In general computable real arithmetic is undecidable.) Note that if the production of a Creal
depends on comparison, there is no guarantee that the Creal
will be accurate to any precision.
(CR-PRINT X K)
[FUNCTION]
Prints a real R
up to K
bits of precision.
(RATIONAL-APPROX X K)
[FUNCTION]
Produce a rational approximation of X
called R
such that
`|R - X| < 2^(-K)`.
(RATIONALIZE X K)
[FUNCTION]
Produce a rational approximation of X
called R
such that
`|R - X| < 2^(-K)`,
taking into account the maximum precision specified by K
to return
the simplest possible such approximation.
(SET-COMPARISON-THRESHOLD! K)
[FUNCTION]
∀ :A. (:A →
UNIT
)
Sets the global Creal
comparison threshold to k bits after the ‘decimal’ point.
See comparison-threshold
for more details.
Package COALTON-LIBRARY/FILE
This is Coalton’s library for directory utilities and file IO.
Most functions return outputs of type (Result FileError :a)
, ensuring that errors can be assessed and handled.
File IO is handled using stream options, for instance:
(with-open-file (Bidirectional file EError)
(fn (stream)
(write-string stream "Hello World!")
(read-file-to-vector stream)
Common Lisp makes a distinction between file and directory paths. Directory paths are always terminated with a trailing slash, file paths must never have a trailing slash.
Types
FILEERROR
[TYPE]
(PATHERROR
STRING
PATHNAME
)(LISPERROR
LISPCONDITION
)EOF
Errors for file functions.
Instances
FILESTREAM
[TYPE]
Represents a file stream, using cl:file-stream
.
Instances
RUNTIMEREPR (
FILESTREAM
:A)
IFEXISTS
[TYPE]
Possible options for opening a stream when the file exists.
Instances
PATHNAME
[TYPE]
Pathname object. Equivalent to cl:pathname
Instances
STREAMOPTIONS
[TYPE]
A type for providing parameters for opening streams. StreamOptions take strings for pathnames, but they will error if they are not proper and appropriate pathnames.
Instances
Classes
FILE
[CLASS]
FILE :A
A class of types which are able to be written to or read from a file.
Methods:
OPEN :: (
STREAMOPTIONS
→ (RESULT
FILEERROR
(FILESTREAM
:A)))READ :: ((
FILESTREAM
:A) → (RESULT
FILEERROR
:A))WRITE :: ((
FILESTREAM
:A) → :A → (RESULT
FILEERROR
UNIT
))
Instances
Values
(ABORT STREAM)
[FUNCTION]
∀ :A :B. ((
FILESTREAM
:A) → (RESULT
FILEERROR
:B))
Closes a FileStream and aborts all operations..
(APPEND-TO-FILE! PATH DATA)
[FUNCTION]
∀ :A :B. (RUNTIMEREPR :B) (INTO :A
PATHNAME
) (FILE :B) ⇒ (:A → (VECTOR
:B) → (RESULT
FILEERROR
UNIT
))
Opens and appends a file with data of type :a.
(CLOSE STREAM)
[FUNCTION]
∀ :A :B. ((
FILESTREAM
:A) → (RESULT
FILEERROR
:B))
Closes a FileStream.
(COPY! INPUT OUTPUT)
[FUNCTION]
∀ :A :B. (INTO :A
PATHNAME
) (INTO :B PATHNAME
) ⇒ (:A → :B → (RESULT
FILEERROR
UNIT
))
Copies a file to a new location.
(CREATE-DIRECTORY! PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → (RESULT
FILEERROR
PATHNAME
))
This is equivalent to mkdir -p
. Creates a directory and its parents. The pathname must be a valid directory pathname.
(CREATE-TEMP-DIRECTORY! _)
[FUNCTION]
(
UNIT
→ (RESULT
FILEERROR
PATHNAME
))
This configures a default temporary directory for use.
(CREATE-TEMP-FILE! FILE-EXT)
[FUNCTION]
(
STRING
→ (RESULT
FILEERROR
PATHNAME
))
This configures a default temporary file for use.
(DELETE-FILE! PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → (RESULT
FILEERROR
UNIT
))
Deletes a given file if the file exists.
(DIRECTORY-EXISTS? PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → (RESULT
FILEERROR
BOOLEAN
))
Returns True if a pathname names a directory that exists.
(DIRECTORY-FILES PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → (RESULT
FILEERROR
(LIST
PATHNAME
)))
Returns all files within the directory. Returns an error if the pathname is not a directory pathname.
(DIRECTORY-PATHNAME? PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → BOOLEAN
)
Returns True if a pathname has no file component.
(EMPTY? PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → (RESULT
FILEERROR
BOOLEAN
))
Checks whether a directory is empty.
(EXISTS? PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → (RESULT
FILEERROR
BOOLEAN
))
Returns whether a file or directory exists.
(FILE-EXISTS? PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → (RESULT
FILEERROR
BOOLEAN
))
Returns True if a pathname names a file that exists.
(FILE-PATHNAME? PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → BOOLEAN
)
Returns True if a pathname has a file component.
(FILE-POSITION STREAM)
[FUNCTION]
∀ :A. ((
FILESTREAM
:A) → (RESULT
FILEERROR
UFIX
))
Finds the file-position of a file stream.
(FLUSH STREAM)
[FUNCTION]
∀ :A :B. ((
FILESTREAM
:A) → (RESULT
FILEERROR
:B))
Blocks until stream
has been flushed. Calls cl:finish-output
.
(MERGE PATH1 PATH2)
[FUNCTION]
∀ :A :B. (INTO :A
PATHNAME
) (INTO :B PATHNAME
) ⇒ (:A → :B → PATHNAME
)
Merges two pathnames together. The directory pathname should be the first argument.
(READ-CHAR STREAM)
[FUNCTION]
((
FILESTREAM
CHAR
) → (RESULT
FILEERROR
CHAR
))
Reads a character from an FileStream.
(READ-FILE-LINES PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → (RESULT
FILEERROR
(LIST
STRING
)))
Reads a file into lines, given a pathname or string.
(READ-FILE-TO-STRING PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → (RESULT
FILEERROR
STRING
))
Reads a file into a string, given a pathname string.
(READ-FILE-TO-VECTOR STREAM)
[FUNCTION]
∀ :A. (RUNTIMEREPR :A) (FILE :A) ⇒ ((
FILESTREAM
:A) → (RESULT
FILEERROR
(VECTOR
:A)))
Reads a file into a vector of type :a
.
(READ-VECTOR STREAM CHUNK-SIZE)
[FUNCTION]
∀ :A. FILE :A ⇒ ((
FILESTREAM
:A) → UFIX
→ (RESULT
FILEERROR
(VECTOR
:A)))
Reads a chunk of a file into a vector of type :a
.
(REMOVE-DIRECTORY! PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → (RESULT
FILEERROR
:A))
Deletes an empty directory.
(REMOVE-DIRECTORY-RECURSIVE! PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → (RESULT
FILEERROR
UNIT
))
Deletes a target directory recursively. Equivalent to rm -r
. Errors if the path is not a directory.
(SET-FILE-POSITION STREAM I)
[FUNCTION]
∀ :A. ((
FILESTREAM
:A) → UFIX
→ (RESULT
FILEERROR
UNIT
))
Sets the file position of a file stream.
(SUBDIRECTORIES PATH)
[FUNCTION]
∀ :A. INTO :A
PATHNAME
⇒ (:A → (RESULT
FILEERROR
(LIST
PATHNAME
)))
Returns all subdirectories within the directory. Returns an error if the pathname is not a directory pathname.
(SYSTEM-RELATIVE-PATHNAME SYSTEM-NAME NAME)
[FUNCTION]
∀ :A. INTO :A
STRING
⇒ (:A → STRING
→ (RESULT
FILEERROR
PATHNAME
))
Generates a system-relative-pathname for a given filename or path. This is a wrapper for asdf:system-relative-pathname
. Name
will likely be an empty string unless a subdirectory or filename is specified.
(WITH-OPEN-FILE STREAM-OPTIONS THUNK)
[FUNCTION]
∀ :A :B. FILE :A ⇒ (
STREAMOPTIONS
→ ((FILESTREAM
:A) → (RESULT
FILEERROR
:B)) → (RESULT
FILEERROR
:B))
Opens a file stream, performs thunk
on it, then closes the stream.
(WITH-TEMP-DIRECTORY THUNK)
[FUNCTION]
∀ :A. ((
PATHNAME
→ (RESULT
FILEERROR
:A)) → (RESULT
FILEERROR
:A))
Performs an operation thunk
inside a temporary directory.
(WITH-TEMP-FILE FILE-TYPE THUNK)
[FUNCTION]
∀ :A :B. FILE :A ⇒ (
STRING
→ ((FILESTREAM
:A) → (RESULT
FILEERROR
:B)) → (RESULT
FILEERROR
:B))
Performs an operation thunk
on a temporary file. File type extensions need to include .
, like “.txt”.
(WRITE-CHAR STREAM DATA)
[FUNCTION]
((
FILESTREAM
CHAR
) → CHAR
→ (RESULT
FILEERROR
UNIT
))
Writes a Char
to the stream.
(WRITE-LINE STREAM S)
[FUNCTION]
((
FILESTREAM
CHAR
) → STRING
→ (RESULT
FILEERROR
UNIT
))
Writes a string with an appended newline to a filestream of type Char.
(WRITE-STRING FS S)
[FUNCTION]
((
FILESTREAM
CHAR
) → STRING
→ (RESULT
FILEERROR
UNIT
))
Writes a string
to a FileStream of type Char.
(WRITE-TO-FILE! PATH DATA)
[FUNCTION]
∀ :A :B. (RUNTIMEREPR :B) (INTO :A
PATHNAME
) (FILE :B) ⇒ (:A → (VECTOR
:B) → (RESULT
FILEERROR
UNIT
))
Opens and writes to a file with data of type :a. Supersedes existing data on the file.
(WRITE-VECTOR STREAM V)
[FUNCTION]
∀ :A. (RUNTIMEREPR :A) (FILE :A) ⇒ ((
FILESTREAM
:A) → (VECTOR
:A) → (RESULT
FILEERROR
UNIT
))
Writes elements of an vector of type :a
to a stream of type :a
.
Package COALTON-LIBRARY/FUNCTIONS
Values
(/= A B)
[FUNCTION]
∀ :A. EQ :A ⇒ (:A → :A →
BOOLEAN
)
Is a
not equal to b
?
(ASUM XS)
[FUNCTION]
∀ :A :B :C. (ALTERNATIVE :B) (FOLDABLE :A) ⇒ ((:A (:B :C)) → (:B :C))
Fold over a list using alt
.
(BRACKET INIT EXIT BODY)
[FUNCTION]
∀ :A :B :C :D. MONAD :A ⇒ ((:A :B) → (:B → (:A :C)) → (:B → (:A :D)) → (:A :D))
Bracket takes an initial state, performs a body of operations, and then forces a safe exit.
This wraps cl:unwind-protect
.
Modeled after Haskell: https://wiki.haskell.org/Bracket_pattern
(COMPLEMENT F X)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → :A → BOOLEAN
)
Compute the complement of a unary Boolean function.
(COMPOSE F G)
[FUNCTION]
∀ :A :B :C. ((:A → :B) → (:C → :A) → :C → :B)
Produces a function equivalent to applying g
followed by f
.
(CONJOIN F G X)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (:A → BOOLEAN
) → :A → BOOLEAN
)
Compute the conjunction of two unary Boolean functions.
(CONST A _B)
[FUNCTION]
∀ :A :B. (:A → :B → :A)
A function that always returns its first argument.
(CURRY FUNC LEFT RIGHT)
[FUNCTION]
∀ :A :B :C. (((
TUPLE
:A :B) → :C) → :A → :B → :C)
Take a function whose input is a tuple and enable curried application of the left and right parameters, equivalent to (func (Tuple left right))
.
(DISJOIN F G X)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (:A → BOOLEAN
) → :A → BOOLEAN
)
Compute the disjunction of two unary Boolean functions.
(FIX F N)
[FUNCTION]
∀ :A :B. (((:A → :B) → :A → :B) → :A → :B)
Compute the fixed point of a unary function. This is equivalent to the Y-combinator of the lambda calculus. This combinator allows recursion without specific assignment of names. For example, the factorial function can be written
(define fact
(fix
(fn (f n)
(if (== n 0)
1
(* n (f (- n 1)))))))
(FLIP F X Y)
[FUNCTION]
∀ :A :B :C. ((:A → :B → :C) → :B → :A → :C)
Returns a function that takes its arguments in reverse order.
(ID X)
[FUNCTION]
∀ :A. (:A → :A)
A function that always returns its argument.
(MSUM XS)
[FUNCTION]
∀ :A :B. (MONOID :B) (FOLDABLE :A) ⇒ ((:A :B) → :B)
Fold over a list using <>
.
(PAIR-WITH FUNC LEFT)
[FUNCTION]
∀ :A :B. ((:A → :B) → :A → (
TUPLE
:A :B))
Create a Tuple
of the form (Tuple left (func left))
.
(PRINT ITEM)
[FUNCTION]
∀ :A. INTO :A
STRING
⇒ (:A → UNIT
)
Print the String representation of item
to cl:*standard-output*
.
(REDUCE F Y XS)
[FUNCTION]
∀ :A :B :C. FOLDABLE :C ⇒ ((:A → :B → :B) → :B → (:C :A) → :B)
The same as fold
but with the argument order swapped to match cl:reduce
(TRACE STR)
[FUNCTION]
Print a line to cl:*standard-output*
.
(TRACEOBJECT STR ITEM)
[FUNCTION]
Print a line to cl:*standard-output*
in the form “{STR}: {ITEM}”.
(UNCURRY FUNC TPL)
[FUNCTION]
∀ :A :B :C. ((:A → :B → :C) → (
TUPLE
:A :B) → :C)
Take a function with two currying parameters and enable their input as a single Tuple
.
(UNSAFE-POINTER-EQ? A B)
[FUNCTION]
∀ :A. (:A → :A →
BOOLEAN
)
Package COALTON-LIBRARY/HASH
Types
HASH
[TYPE]
Implementation dependent hash code
Classes
HASH
[CLASS]
Types which can be hashed for storage in hash tables.
The hash function must satisfy the invariant that (== left right)
implies (== (hash left) (hash right))
.
Methods:
HASH :: (:A →
HASH
)
Instances
(HASH :A) (HASH :B) ⇒ HASH (
MAP
:A :B)HASH :A ⇒ HASH (
TREE
:A)(HASH :A) (HASH :B) ⇒ HASH (
HASHTABLE
:A :B)HASH
STRING
HASH
CHAR
HASH :A ⇒ HASH (
LIST
:A)(HASH :A) (HASH :B) (HASH :C) (HASH :D) (HASH :E) ⇒ HASH (
TUPLE5
:A :B :C :D :E)(HASH :A) (HASH :B) (HASH :C) (HASH :D) ⇒ HASH (
TUPLE4
:A :B :C :D)(HASH :A) (HASH :B) (HASH :C) ⇒ HASH (
TUPLE3
:A :B :C)(HASH :A) (HASH :B) ⇒ HASH (
TUPLE
:A :B)HASH :A ⇒ HASH (
DUAL
:A)
Note: Hash only considers the primal component in order to be consistent with Eq.HASH
DOUBLE-FLOAT
HASH
SINGLE-FLOAT
HASH
UFIX
HASH
IFIX
HASH
U64
HASH
U32
HASH
U16
HASH
U8
HASH
I64
HASH
I32
HASH
I16
HASH
I8
HASH
INTEGER
HASH
BOOLEAN
HASH
HASH
Values
(COMBINE-HASHES LHS RHS)
[FUNCTION]
(COMBINE-HASHES-ORDER-INDEPENDENT LHS RHS)
[FUNCTION]
Package COALTON-LIBRARY/HASHTABLE
Types
HASHTABLE
[TYPE]
A mutable hash table.
Instances
Values
(COUNT TABLE)
[FUNCTION]
∀ :A :B. ((
HASHTABLE
:A :B) → INTEGER
)
Returns the number of entries in TABLE
(ENTRIES TABLE)
[FUNCTION]
∀ :A :B. ((
HASHTABLE
:A :B) → (ITERATOR
(TUPLE
:A :B)))
Returns the key-values pairs as a list.
(EXTEND! TABLE ITER)
[FUNCTION]
∀ :A :B :C. (HASH :A) (INTOITERATOR :C (
TUPLE
:A :B)) ⇒ ((HASHTABLE
:A :B) → :C → UNIT
)
Insert all of the key value pairs from ITER into TABLE, overwriting duplicate keys.
(GET TABLE KEY)
[FUNCTION]
∀ :A :B. HASH :A ⇒ ((
HASHTABLE
:A :B) → :A → (OPTIONAL
:B))
Lookup KEY in TABLE
(KEYS TABLE)
[FUNCTION]
∀ :A :B. ((
HASHTABLE
:A :B) → (ITERATOR
:A))
Returns the keys in TABLE as a list
(NEW _)
[FUNCTION]
∀ :A :B. HASH :A ⇒ (
UNIT
→ (HASHTABLE
:A :B))
Create a new empty hashtable
(REMOVE! TABLE KEY)
[FUNCTION]
∀ :A :B. HASH :A ⇒ ((
HASHTABLE
:A :B) → :A → UNIT
)
Remove the entry at KEY from TABLE
(SET! TABLE KEY VALUE)
[FUNCTION]
∀ :A :B. HASH :A ⇒ ((
HASHTABLE
:A :B) → :A → :B → UNIT
)
Set KEY to VALUE in TABLE
(VALUES TABLE)
[FUNCTION]
∀ :A :B. ((
HASHTABLE
:A :B) → (ITERATOR
:B))
Returns the values in TABLE as a list
(WITH-CAPACITY CAPACITY)
[FUNCTION]
∀ :A :B. HASH :A ⇒ (
INTEGER
→ (HASHTABLE
:A :B))
Create a new empty hashtable with a given capacity
Package COALTON-LIBRARY/ITERATOR
Types
ITERATOR
[TYPE]
A forward-moving pointer into an ordered sequence of :ELTs
Instances
FUNCTOR
ITERATOR
INTOITERATOR (
ITERATOR
:A) :ARUNTIMEREPR (
ITERATOR
:A)
Classes
FROMITERATOR
[CLASS]
FROMITERATOR :A :B
Methods:
COLLECT! :: ((
ITERATOR
:A) → :B)
Instances
RUNTIMEREPR :A ⇒ FROMITERATOR (
SEQ
:A) :AORD :A ⇒ FROMITERATOR (
MAP
:A :B) (TUPLE
:A :B)ORD :A ⇒ FROMITERATOR (
TREE
:A) :AFROMITERATOR (
QUEUE
:A) :AHASH :A ⇒ FROMITERATOR (
HASHTABLE
:A :B) (TUPLE
:A :B)FROMITERATOR (
SLICE
:A) :AFROMITERATOR
STRING
CHAR
FROMITERATOR (
VECTOR
:A) :AFROMITERATOR (
LIST
:A) :AFROMITERATOR :A :B ⇒ FROMITERATOR (
RESULT
:C :A) (RESULT
:C :B)FROMITERATOR :A :B ⇒ FROMITERATOR (
OPTIONAL
:A) (OPTIONAL
:B)
INTOITERATOR
[CLASS]
INTOITERATOR :A :B
Containers which can be converted into iterators.
INTO-ITER
must not mutate its argument, only produce a “view” into it.
Methods:
INTO-ITER :: (:A → (
ITERATOR
:B))
Instances
INTOITERATOR (
SEQ
:A) :AINTOITERATOR (
MAP
:A :B) (TUPLE
:A :B)INTOITERATOR (
TREE
:A) :AINTOITERATOR (
QUEUE
:A) :AINTOITERATOR (
HASHTABLE
:A :B) (TUPLE
:A :B)INTOITERATOR (
SLICE
:A) :AINTOITERATOR
STRING
CHAR
INTOITERATOR (
VECTOR
:A) :AINTOITERATOR (
LIST
:A) :AINTOITERATOR (
RESULT
:A :B) :BINTOITERATOR (
OPTIONAL
:A) :AINTOITERATOR
UNIT
:AINTOITERATOR (
ITERATOR
:A) :A
Values
(AND! ITER)
[FUNCTION]
((
ITERATOR
BOOLEAN
) → BOOLEAN
)
Returns True if all iterator elements are True. May not consume the entire iterator. Returns True on an empty iterator.
(ANY! GOOD? ITER)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (ITERATOR
:A) → BOOLEAN
)
Return True
as soon as any element of ITER is GOOD?, or False
if none of them are.
Returns False
if ITER is empty.
(CHAIN! ITER1 ITER2)
[FUNCTION]
∀ :A. ((
ITERATOR
:A) → (ITERATOR
:A) → (ITERATOR
:A))
Yield all the elements of ITER1 followed by all the elements from ITER2.
(COUNT! ITER)
[FUNCTION]
Return the number of elements in ITER.
This operation could be called length!
, but count!
emphasizes the fact that it consumes ITER, and
afterwards, ITER will be exhausted.
(COUNT-FOREVER _)
[FUNCTION]
∀ :A. (NUM :A) (ORD :A) ⇒ (
UNIT
→ (ITERATOR
:A))
An infinite iterator which starts at 0 and counts upwards by 1.
(DOWN-FROM LIMIT)
[FUNCTION]
∀ :A. (NUM :A) (ORD :A) ⇒ (:A → (
ITERATOR
:A))
An iterator which begins below the provided limit and counts down through and including zero.
(ELEMENTWISE-HASH! ITER)
[FUNCTION]
∀ :A. HASH :A ⇒ ((
ITERATOR
:A) → HASH
)
Hash an iterator by combining the hashes of all its elements.
The empty iterator will hash as 0.
(ELEMENTWISE-MATCH! SAME? LEFT RIGHT)
[FUNCTION]
∀ :A. ((:A → :A →
BOOLEAN
) → (ITERATOR
:A) → (ITERATOR
:A) → BOOLEAN
)
Are LEFT and RIGHT elementwise-identical under SAME?
True if, for every pair of elements (A B) in (LEFT RIGHT), (same? A B) is True, and LEFT and RIGHT have the same length.
(ELEMENTWISE==!)
[FUNCTION]
∀ :A. EQ :A ⇒ ((
ITERATOR
:A) → (ITERATOR
:A) → BOOLEAN
)
Is every element of the first iterator `==’ to the corresponding element of the second?
True if two iterators have the same length, and for every N, the Nth element of the first iterator is `==’ to the Nth element of the second iterator.
(ENUMERATE! ITER)
[FUNCTION]
∀ :A. ((
ITERATOR
:A) → (ITERATOR
(TUPLE
UFIX
:A)))
Pair successive zero-based incides with elements from ITER
(EVERY! GOOD? ITER)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (ITERATOR
:A) → BOOLEAN
)
Return True
if every element of ITER is GOOD?, or False
as soon as any element is not GOOD?.
Returns True
if ITER is empty.
(FILTER! KEEP? ITER)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (ITERATOR
:A) → (ITERATOR
:A))
Return an iterator over the elements from ITER for which KEEP?returns true.
(FILTER-MAP! F ITER)
[FUNCTION]
∀ :A :B. ((:A → (
OPTIONAL
:B)) → (ITERATOR
:A) → (ITERATOR
:B))
Map an iterator, retaining only the elements where F returns SOME.
(FIND! THIS? ITER)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (ITERATOR
:A) → (OPTIONAL
:A))
Return the first element of ITER for which THIS? returns True
, or None
if no element matches.
(FIND-MAP! F)
[FUNCTION]
∀ :A :B. ((:A → (
OPTIONAL
:B)) → (ITERATOR
:A) → (OPTIONAL
:B))
Return the first element of (map F ITER) for which F returns Some
.
(FLAT-MAP! FUNC ITER)
[FUNCTION]
∀ :A :B. ((:A → (
ITERATOR
:B)) → (ITERATOR
:A) → (ITERATOR
:B))
Flatten! wrapped around map.
(FLATTEN! ITERS)
[FUNCTION]
∀ :A. ((
ITERATOR
(ITERATOR
:A)) → (ITERATOR
:A))
Yield all the elements from each of the ITERS in order.
(FOLD! FUNC INIT ITER)
[FUNCTION]
∀ :A :B. ((:A → :B → :A) → :A → (
ITERATOR
:B) → :A)
Tail recursive in-order fold. Common Lisp calls this operation reduce
.
If ITER is empty, returns INIT. Otherwise, calls (FUNC STATE ITEM) for each ITEM of ITER to produce a new STATE, using INIT as the first STATE.
(FOR-EACH! THUNK ITER)
[FUNCTION]
∀ :A. ((:A →
UNIT
) → (ITERATOR
:A) → UNIT
)
Call THUNK on each element of ITER in order for side effects. Discard values returned by THUNK.
(INDEX-OF! THIS? ITER)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (ITERATOR
:A) → (OPTIONAL
UFIX
))
Return the zero-based index of the first element of ITER for which THIS? is True
, or None
if no element matches.
(INTERLEAVE! LEFT RIGHT)
[FUNCTION]
∀ :A. ((
ITERATOR
:A) → (ITERATOR
:A) → (ITERATOR
:A))
Return an interator of interleaved elements from LEFT and RIGHT which terminates as soon as both LEFT and RIGHT do.
If one iterator terminates before the other, elements from the longer iterator will be yielded without interleaving. (interleave empty ITER) is equivalent to (id ITER).
(LAST! ITER)
[FUNCTION]
∀ :A. ((
ITERATOR
:A) → (OPTIONAL
:A))
Yields the last element of ITER, completely consuming it.
(MAP-WHILE! F ITER)
[FUNCTION]
∀ :A :B. ((:A → (
OPTIONAL
:B)) → (ITERATOR
:A) → (ITERATOR
:B))
Map an iterator, stopping early if F returns NONE.
(MAX! ITER)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
ITERATOR
:A) → (OPTIONAL
:A))
Return the most-positive element of ITER, or None
if ITER is empty.
(MAXIMIZE-BY! F ITER)
[FUNCTION]
∀ :A :B. ORD :B ⇒ ((:A → :B) → (
ITERATOR
:A) → (OPTIONAL
:A))
For a function F, which maps the iterator, return the element of ITER where (F ELT) is the most-positive.
Return `None’ if ITER is empty.
(MIN! ITER)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
ITERATOR
:A) → (OPTIONAL
:A))
Return the most-negative element of ITER, or None
if ITER is empty.
(MINIMIZE-BY! F ITER)
[FUNCTION]
∀ :A :B. ORD :B ⇒ ((:A → :B) → (
ITERATOR
:A) → (OPTIONAL
:A))
For a function F, which maps the iterator, return the element of ITER where (F ELT) is the most-negative.
Return `None’ if ITER is empty.
(NEW F)
[FUNCTION]
∀ :A. ((
UNIT
→ (OPTIONAL
:A)) → (ITERATOR
:A))
Create a new iterator from a function that yields elements.
(NEXT! ITER)
[FUNCTION]
∀ :A. ((
ITERATOR
:A) → (OPTIONAL
:A))
Advance ITER, returning its next yielded value, or None
if the iterator is exhausted.
Behavior is undefined if two threads concurrently call next!
on the same iterator without a lock. Note that
most of the operators defined on iterators call next!
internally, or create new iterators which will call
next!
on their inputs.
(ONCE ITEM)
[FUNCTION]
∀ :A. (:A → (
ITERATOR
:A))
Yield item
once.
(OPTIMIZE! BETTER? ITER)
[FUNCTION]
∀ :A. ((:A → :A →
BOOLEAN
) → (ITERATOR
:A) → (OPTIONAL
:A))
For an order BETTER? which returns True
if its first argument is better than its second argument, return the best element of ITER.
Return None
if ITER is empty.
(OPTIMIZE-BY! BETTER? F ITER)
[FUNCTION]
∀ :A :B. ((:A → :A →
BOOLEAN
) → (:B → :A) → (ITERATOR
:B) → (OPTIONAL
:B))
For an order BETTER? which returns True
if its first argument is better than its second argument, return the element of ITER where (F ELT) is the best.
Return None
if ITER is empty.
(OR! ITER)
[FUNCTION]
((
ITERATOR
BOOLEAN
) → BOOLEAN
)
Returns True if any iterator elements are True. May not consume the entire iterator. Returns False on an empty iterator.
(PAIR-WITH! FUNC KEYS)
[FUNCTION]
∀ :A :B. ((:A → :B) → (
ITERATOR
:A) → (ITERATOR
(TUPLE
:A :B)))
Returns an iterator over tuples whose FSTs are elements from KEYS, and whose SNDs are the results of applying FUNC to those KEYS.
(RANGE-DECREASING STEP START END)
[FUNCTION]
∀ :A. (NUM :A) (ORD :A) ⇒ (:A → :A → :A → (
ITERATOR
:A))
A range which begins below START and counts down through and including END by STEP.
Equivalent to reversing range-increasing
(RANGE-INCREASING STEP START END)
[FUNCTION]
∀ :A. (NUM :A) (ORD :A) ⇒ (:A → :A → :A → (
ITERATOR
:A))
An iterator which begins at START and yields successive elements spaced by STEP, stopping before END.
(RECURSIVE-ITER SUCC DONE? START)
[FUNCTION]
∀ :A. ((:A → :A) → (:A →
BOOLEAN
) → :A → (ITERATOR
:A))
An iterator which yields first START, then (SUCC START), then (SUCC (SUCC START)), and so on, stopping as soon as such a value is done?
.
Beware off-by-one errors: the first value which is done?
is not yielded. If `(done? start)’ is true, the
iterator is empty.
(REMOVE-DUPLICATES! ITER)
[FUNCTION]
∀ :A. HASH :A ⇒ ((
ITERATOR
:A) → (ITERATOR
:A))
Yield unique elements from ITER in order of first appearance.
(REPEAT ITEM)
[FUNCTION]
∀ :A. (:A → (
ITERATOR
:A))
Yield ITEM over and over, infinitely.
(REPEAT-FOR ITEM COUNT)
[FUNCTION]
∀ :A. (:A →
UFIX
→ (ITERATOR
:A))
Yield ITEM COUNT times, then stop.
(SIZE-HINT ITER)
[FUNCTION]
∀ :A. ((
ITERATOR
:A) → (OPTIONAL
UFIX
))
(SUM! ITER)
[FUNCTION]
∀ :A. NUM :A ⇒ ((
ITERATOR
:A) → :A)
Add together all the elements of ITER.
(TAKE! COUNT ITER)
[FUNCTION]
∀ :A. (
UFIX
→ (ITERATOR
:A) → (ITERATOR
:A))
An Iterator
which yields at most COUNT elements from ITER.
(UNWRAPPED! ITER)
[FUNCTION]
∀ :A :B. UNWRAPPABLE :A ⇒ ((
ITERATOR
(:A :B)) → (ITERATOR
:B))
(UP-THROUGH LIMIT)
[FUNCTION]
∀ :A. (NUM :A) (ORD :A) ⇒ (:A → (
ITERATOR
:A))
An iterator which begins at zero and counts up through and including LIMIT.
(UP-TO LIMIT)
[FUNCTION]
∀ :A. (NUM :A) (ORD :A) ⇒ (:A → (
ITERATOR
:A))
An iterator which begins at zero and counts up to, but not including, LIMIT.
(WITH-SIZE F SIZE)
[FUNCTION]
∀ :A. ((
UNIT
→ (OPTIONAL
:A)) → UFIX
→ (ITERATOR
:A))
(ZIP!)
[FUNCTION]
∀ :A :B. ((
ITERATOR
:A) → (ITERATOR
:B) → (ITERATOR
(TUPLE
:A :B)))
Return an iterator of tuples contining elements from two iterators.
(ZIP-WITH! F LEFT RIGHT)
[FUNCTION]
∀ :A :B :C. ((:A → :B → :C) → (
ITERATOR
:A) → (ITERATOR
:B) → (ITERATOR
:C))
Return an iterator of elements from LEFT and RIGHT which terminates as soon as either LEFT or RIGHT does.
EMPTY
[VALUE]
∀ :A. (
ITERATOR
:A)
Yields nothing; stops immediately
Package COALTON-LIBRARY/LISPARRAY
Types
LISPARRAY
[TYPE]
A one-dimensional, non-resizable array of elements.
These arrays are represented as possibly specialized (cl:simple-array <type> (cl:*))
and are meant to be used as a tool either to interface with Lisp code or to implement efficient data structures. One should consult Vector
or Seq
for more general sequential data structure needs.
Whether or not the arrays are specialized depends on the underlying Lisp implementation. Consult cl:upgraded-array-element-type
to determine whether LispArray
may get specialized.
Instances
RUNTIMEREPR (
LISPARRAY
:A)
Values
(AREF V I)
[FUNCTION]
∀ :A. ((
LISPARRAY
:A) → UFIX
→ :A)
Read the i
th value of the LispArray
v
.
(LENGTH V)
[FUNCTION]
Return the length of the LispArray
v
.
(MAKE N X)
[FUNCTION]
∀ :A. RUNTIMEREPR :A ⇒ (
UFIX
→ :A → (LISPARRAY
:A))
Make a new LispArray
of length n
initialized to x
.
If the type of x
represents a specialized array
(MAKE-UNINITIALIZED N)
[FUNCTION]
∀ :A. RUNTIMEREPR :A ⇒ (
UFIX
→ (LISPARRAY
:A))
Make a new LispArray of length n
that can store elements of type :t
.
WARNING: The consequences are undefined if an uninitialized element is read before being set.
(SET! V I X)
[FUNCTION]
∀ :A. ((
LISPARRAY
:A) → UFIX
→ :A → UNIT
)
Set the i
th value of the LispArray
v
to x
.
Package COALTON-LIBRARY/LIST
Values
(ALL F XS)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (LIST
:A) → BOOLEAN
)
Returns TRUE if every element in XS matches F.
(ANY F L)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (LIST
:A) → BOOLEAN
)
Returns TRUE if at least one element in XS matches F.
(APPEND XS YS)
[FUNCTION]
∀ :A. ((
LIST
:A) → (LIST
:A) → (LIST
:A))
Appends two lists together and returns a new list.
(CAR X)
[FUNCTION]
∀ :A. ((
LIST
:A) → :A)
Return the traditional car of a list. This function is partial
(CDR XS)
[FUNCTION]
Return the traditional cdr of a list.
(COMBS L)
[FUNCTION]
∀ :A. ((
LIST
:A) → (LIST
(LIST
:A)))
Compute a list of all combinations of elements of L. This function is sometimes goes by the name “power set” or “subsets”.
The ordering of elements of L is preserved in the ordering of elements in each list produced by (COMBS L)
.
(COMBSOF N L)
[FUNCTION]
∀ :A. (
UFIX
→ (LIST
:A) → (LIST
(LIST
:A)))
Produce a list of size-N subsets of L.
The ordering of elements of L is preserved in the ordering of elements in each list produced by (COMBSOF N L)
.
This function is equivalent to all size-N elements of (COMBS L)
.
(CONCAT XS)
[FUNCTION]
∀ :A. ((
LIST
(LIST
:A)) → (LIST
:A))
Appends a list of lists together into a single new list.
(CONCATMAP F XS)
[FUNCTION]
∀ :A :B. ((:A → (
LIST
:B)) → (LIST
:A) → (LIST
:B))
Apply F to each element in XS and concatenate the results.
(COUNTBY F THINGS)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (LIST
:A) → UFIX
)
Count the number of items in THINGS that satisfy the predicate F.
(DIFFERENCE XS YS)
[FUNCTION]
∀ :A. EQ :A ⇒ ((
LIST
:A) → (LIST
:A) → (LIST
:A))
Returns a new list with the first occurence of each element in ys
removed from xs
.
(DROP N XS)
[FUNCTION]
∀ :A. (
UFIX
→ (LIST
:A) → (LIST
:A))
Returns a list with the first N elements removed.
(ELEMINDEX X XS)
[FUNCTION]
∀ :A. EQ :A ⇒ (:A → (
LIST
:A) → (OPTIONAL
UFIX
))
(EQUIVALENCE-CLASSES)
[FUNCTION]
∀ :A. EQ :A ⇒ ((
LIST
:A) → (LIST
(LIST
:A)))
(EQUIVALENCE-CLASSES-BY F L)
[FUNCTION]
∀ :A. ((:A → :A →
BOOLEAN
) → (LIST
:A) → (LIST
(LIST
:A)))
Break a list into a list of equivalence classes according to an equivalence relation.
(FILTER F XS)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (LIST
:A) → (LIST
:A))
Returns a new list containing every element of XS that matches the predicate function F in the same order.
(FIND F XS)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (LIST
:A) → (OPTIONAL
:A))
Returns the first element in a list matching the predicate function F.
(FINDINDEX F XS)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (LIST
:A) → (OPTIONAL
UFIX
))
Returns the index of the first element matching the predicate function F.
(HEAD L)
[FUNCTION]
∀ :A. ((
LIST
:A) → (OPTIONAL
:A))
Returns the first element of a list.
(INDEX I XS)
[FUNCTION]
∀ :A. (
UFIX
→ (LIST
:A) → (OPTIONAL
:A))
Returns the Ith element of a list.
(INIT L)
[FUNCTION]
Returns every element except the last in a list.
(INSERT E LS)
[FUNCTION]
∀ :A. ORD :A ⇒ (:A → (
LIST
:A) → (LIST
:A))
Inserts an element into a list at the first place it is less than or equal to the next element.
(INSERTBY CMP X YS)
[FUNCTION]
∀ :A. ((:A → :A →
ORD
) → :A → (LIST
:A) → (LIST
:A))
Generic version of insert
(INSERTIONS A L)
[FUNCTION]
∀ :A. (:A → (
LIST
:A) → (LIST
(LIST
:A)))
Produce a list of copies of L, each with A inserted at a possible position.
(insertions 0 (make-list 1 2))
=> ((0 1 2) (1 0 2) (1 2 0))
(INTERCALATE XS XSS)
[FUNCTION]
∀ :A. ((
LIST
:A) → (LIST
(LIST
:A)) → (LIST
:A))
Intersperses XS into XSS and then concatenates the result.
(INTERSECTION XS YS)
[FUNCTION]
∀ :A. EQ :A ⇒ ((
LIST
:A) → (LIST
:A) → (LIST
:A))
Returns elements which occur in both lists. Does not return duplicates and does not guarantee order.
(INTERSPERSE E XS)
[FUNCTION]
∀ :A. (:A → (
LIST
:A) → (LIST
:A))
Returns a new list where every other element is E.
(LAST L)
[FUNCTION]
∀ :A. ((
LIST
:A) → (OPTIONAL
:A))
Returns the last element of a list.
(LENGTH L)
[FUNCTION]
Returns the length of a list.
(LOOKUP E XS)
[FUNCTION]
∀ :A :B. EQ :A ⇒ (:A → (
LIST
(TUPLE
:A :B)) → (OPTIONAL
:B))
Returns the value of the first (key, value) tuple in XS where the key matches E.
(MAXIMUM L)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
LIST
:A) → (OPTIONAL
:A))
Returns a greatest element of a list, or None.
(MEMBER E XS)
[FUNCTION]
∀ :A. EQ :A ⇒ (:A → (
LIST
:A) → BOOLEAN
)
Returns true if any element of XS is equal to E.
(MINIMUM L)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
LIST
:A) → (OPTIONAL
:A))
Returns a least element of a list, or None.
(NTH N L)
[FUNCTION]
Like INDEX, but errors if the index is not found.
(NTH-CDR N L)
[FUNCTION]
∀ :A. (
UFIX
→ (LIST
:A) → (LIST
:A))
Returns the nth-cdr of a list.
(NULL? XS)
[FUNCTION]
Returns TRUE if XS is an empty list.
(OPTIMUMBY F XS)
[FUNCTION]
∀ :A. ((:A → :A →
BOOLEAN
) → (LIST
:A) → (OPTIONAL
:A))
Returns an optimum according to a total order.
(PARTITION F XS)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (LIST
:A) → (TUPLE
(LIST
:A) (LIST
:A)))
Splits a list into two new lists. The first list contains elements matching predicate F.
(PERMS L)
[FUNCTION]
∀ :A. ((
LIST
:A) → (LIST
(LIST
:A)))
Produce all permutations of the list L.
(PRODUCT XS)
[FUNCTION]
∀ :A. NUM :A ⇒ ((
LIST
:A) → :A)
Returns the product of XS
(RANGE START END)
[FUNCTION]
∀ :A. (NUM :A) (ORD :A) ⇒ (:A → :A → (
LIST
:A))
Returns a list containing the numbers from START to END inclusive, counting by 1.
COALTON-USER> (coalton (range 1 5))
(1 2 3 4 5)
COALTON-USER> (coalton (range 5 2))
(5 4 3 2)
(REMOVE X YS)
[FUNCTION]
∀ :A. EQ :A ⇒ (:A → (
LIST
:A) → (LIST
:A))
Return a new list with the first element equal to x
removed.
(REMOVE-DUPLICATES XS)
[FUNCTION]
∀ :A. EQ :A ⇒ ((
LIST
:A) → (LIST
:A))
Returns a new list without duplicate elements.
(REMOVE-IF PRED XS)
[FUNCTION]
∀ :A. ((:A →
BOOLEAN
) → (LIST
:A) → (LIST
:A))
Return a new list with the first element for which PRED is True
is removed.
(REPEAT N X)
[FUNCTION]
Returns a list with the same value repeated multiple times.
(REVERSE XS)
[FUNCTION]
Returns a new list containing the same elements in reverse order.
(SINGLETON X)
[FUNCTION]
∀ :A. (:A → (
LIST
:A))
Returns a list containing one element.
(SINGLETON? XS)
[FUNCTION]
Is xs
a list containing exactly one element?
(SORT XS)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
LIST
:A) → (LIST
:A))
Performs a sort of XS.
(SORTBY CMP XS)
[FUNCTION]
∀ :A. ((:A → :A →
ORD
) → (LIST
:A) → (LIST
:A))
Generic version of sort
(SPLIT C STR)
[FUNCTION]
(
CHAR
→ STRING
→ (LIST
STRING
))
(SUM XS)
[FUNCTION]
∀ :A. NUM :A ⇒ ((
LIST
:A) → :A)
Returns the sum of XS
(TAIL L)
[FUNCTION]
∀ :A. ((
LIST
:A) → (OPTIONAL
(LIST
:A)))
Returns every element except the first in a list.
(TAKE N XS)
[FUNCTION]
∀ :A. (
UFIX
→ (LIST
:A) → (LIST
:A))
Returns the first N elements of a list.
(TRANSPOSE XS)
[FUNCTION]
∀ :A. ((
LIST
(LIST
:A)) → (LIST
(LIST
:A)))
Transposes a matrix represented by a list of lists.
(UNION XS YS)
[FUNCTION]
∀ :A. EQ :A ⇒ ((
LIST
:A) → (LIST
:A) → (LIST
:A))
Returns a new list with the elements from both XS and YS and without duplicates.
(ZIP XS YS)
[FUNCTION]
∀ :A :B. ((
LIST
:A) → (LIST
:B) → (LIST
(TUPLE
:A :B)))
Builds a list of tuples with the elements of XS and YS.
(ZIPWITH F XS YS)
[FUNCTION]
∀ :A :B :C. ((:A → :B → :C) → (
LIST
:A) → (LIST
:B) → (LIST
:C))
Builds a new list by calling f
with elements of xs
and ys
.
(ZIPWITH3 F XS YS ZS)
[FUNCTION]
∀ :A :B :C :D. ((:A → :B → :C → :D) → (
LIST
:A) → (LIST
:B) → (LIST
:C) → (LIST
:D))
Build a new list by calling F with elements of XS, YS and ZS
(ZIPWITH4 F AS BS CS DS)
[FUNCTION]
∀ :A :B :C :D :E. ((:A → :B → :C → :D → :E) → (
LIST
:A) → (LIST
:B) → (LIST
:C) → (LIST
:D) → (LIST
:E))
Build a new list by calling F with elements of AS, BS, CS and DS
(ZIPWITH5 F AS BS CS DS ES)
[FUNCTION]
∀ :A :B :C :D :E :F. ((:A → :B → :C → :D → :E → :F) → (
LIST
:A) → (LIST
:B) → (LIST
:C) → (LIST
:D) → (LIST
:E) → (LIST
:F))
Build a new list by calling F with elements of AS, BS, CS, DS and ES
Package COALTON-LIBRARY/MATH/ARITH
Classes
DIVIDABLE
[CLASS]
DIVIDABLE :A :B
The representation of a type such that division within that type possibly results in another type. For instance,
(Dividable Integer Fraction)
establishes that division of two Integer
s can result in a Fraction
, whereas
(Dividable Single-Float Single-Float)
establishes that division of two Single-Float
s can result in a Single-Float
.
Note that Dividable
does not establish a default result type; you must constrain the result type yourself.
The function general/
is partial, and will error produce a run-time error if the divisor is zero.
Methods:
GENERAL/ :: (:A → :A → :B)
Instances
RECIPROCABLE
[CLASS]
NUM :A ⇒ RECIPROCABLE :A
Any number with a multiplicative inverse (reciprocal) where:
1 = (* (reciprocal x) x) = (* x (reciprocal x))
(/ x y) = (* x (reciprocal y))
If no reciprocal exists for an element, produce a run-time error (e.g., zero).
Methods:
/ :: (:A → :A → :A)
RECIPROCAL :: (:A → :A)
Instances
RECIPROCABLE
CREAL
RECIPROCABLE
BIG-FLOAT
RECIPROCABLE :A ⇒ RECIPROCABLE (
DUAL
:A)(COMPLEX :A) (RECIPROCABLE :A) ⇒ RECIPROCABLE (
COMPLEX
:A)RECIPROCABLE
FRACTION
RECIPROCABLE
DOUBLE-FLOAT
RECIPROCABLE
SINGLE-FLOAT
TRANSFINITE
[CLASS]
TRANSFINITE :A
Numeric type with a value for (positive) infinity and/or NaN.
Methods:
Values
(1+ NUM)
[FUNCTION]
∀ :A. NUM :A ⇒ (:A → :A)
Increment num
.
(1- NUM)
[FUNCTION]
∀ :A. NUM :A ⇒ (:A → :A)
Decrement num
.
(ABS X)
[FUNCTION]
∀ :A. (ORD :A) (NUM :A) ⇒ (:A → :A)
Absolute value of x
.
(ASH X N)
[FUNCTION]
Compute the “arithmetic shift” of x
by n
.
(FINITE? X)
[FUNCTION]
∀ :A. TRANSFINITE :A ⇒ (:A →
BOOLEAN
)
Neither infinite or NaN.
(NEGATE X)
[FUNCTION]
∀ :A. NUM :A ⇒ (:A → :A)
The negation, or additive inverse, of x
.
(NEGATIVE? X)
[FUNCTION]
∀ :A. (NUM :A) (ORD :A) ⇒ (:A →
BOOLEAN
)
Is x
negative?
(NONNEGATIVE? X)
[FUNCTION]
∀ :A. (NUM :A) (ORD :A) ⇒ (:A →
BOOLEAN
)
Is x
not negative?
(NONPOSITIVE? X)
[FUNCTION]
∀ :A. (NUM :A) (ORD :A) ⇒ (:A →
BOOLEAN
)
Is x
not positive?
(NONZERO? X)
[FUNCTION]
Is x
not zero?
(POSITIVE? X)
[FUNCTION]
∀ :A. (NUM :A) (ORD :A) ⇒ (:A →
BOOLEAN
)
Is x
positive?
(SIGN X)
[FUNCTION]
∀ :A :B. (ORD :A) (NUM :A) (NUM :B) ⇒ (:A → :B)
The sign of x
, where (sign 0) = 1
.
(ZERO? X)
[FUNCTION]
Is x
zero?
NEGATIVE-INFINITY
[VALUE]
∀ :A. (TRANSFINITE :A) (NUM :A) ⇒ :A
Package COALTON-LIBRARY/MATH/BOUNDED
Classes
BOUNDED
[CLASS]
BOUNDED :A
Types which have a maximum and minumum bound.
Methods:
MINBOUND :: :A
MAXBOUND :: :A
Instances
Package COALTON-LIBRARY/MATH/COMPLEX
Types
COMPLEX
[TYPE]
(%COMPLEX :A :A )
Complex number that may either have a native or constructed representation.
Instances
(COMPLEX :A) (INTO :A
CREAL
) ⇒ INTO (COMPLEX
:A) (COMPLEX
CREAL
)(COMPLEX :A) (RECIPROCABLE :A) ⇒ RECIPROCABLE (
COMPLEX
:A)COMPLEX :A ⇒ COMPLEX (
COMPLEX
:A)COMPLEX :A ⇒ EQ (
COMPLEX
:A)COMPLEX :A ⇒ INTO :A (
COMPLEX
:A)COMPLEX :A ⇒ NUM (
COMPLEX
:A)ELEMENTARY :A ⇒ ELEMENTARY (
COMPLEX
:A)ELEMENTARY :A ⇒ EXPONENTIABLE (
COMPLEX
:A)ELEMENTARY :A ⇒ POLAR (
COMPLEX
:A)ELEMENTARY :A ⇒ RADICAL (
COMPLEX
:A)ELEMENTARY :A ⇒ TRIGONOMETRIC (
COMPLEX
:A)RUNTIMEREPR (
COMPLEX
:A)
Classes
COMPLEX
[CLASS]
Methods:
COMPLEX :: (:A → :A → (
COMPLEX
:A))REAL-PART :: ((
COMPLEX
:A) → :A)IMAG-PART :: ((
COMPLEX
:A) → :A)
Instances
Values
(CONJUGATE N)
[FUNCTION]
∀ :A. COMPLEX :A ⇒ ((
COMPLEX
:A) → (COMPLEX
:A))
The complex conjugate.
(SQUARE-MAGNITUDE A)
[FUNCTION]
∀ :A. COMPLEX :A ⇒ ((
COMPLEX
:A) → :A)
The length of a complex number.
II
[VALUE]
∀ :A. COMPLEX :A ⇒ (
COMPLEX
:A)
The complex unit i. (The double ii represents a blackboard-bold i.)
Package COALTON-LIBRARY/MATH/DUAL
Dual numbers are a hypercomplex number system [1]. A dual number has
the form a + bε
where a
and b
are real numbers and ε
is a
symbol that satisfies ε^2 = 0
and ε != 0
. The value a
is often
called the primal part and the value b
is often called the dual
part. One application of dual numbers is automatic differentiation;
an example taken from [2] is as follows.
Consider the function f(x) = 3x+2
and you want to calculate f(4)
and f'(4)
. By the usual rules of differentiation, we know f'(x) = 3
and thus (f(4), f'(4)) = (14, 3)
. We seek to recover this with
dual numbers.
With dual numbers, we can calculate
f(a) + f'(a)ε
by taking a real-valued function f
and evaluating as if it were a
dual-valued function at the point a + ε
. Thus, for the defined f
,
we have:
f(4 + ε) = 3(4 + ε) + 2
= 3*4 + 3ε + 2
= 14 + 3ε.
In this result, the primal 14
is the value of f(4)
and the dual is
the value of of f'(4)
.
Haskell has an automatic differentiation library and you can find it here [3].
Limitations:
We have decided to implement Ord, Eq, and Hash to look at only the primal part of numbers. This is so the Dual type can be used primarily for the purpose of automatic differentiation of existing code, and not for general abstract mathematics. If you need these type classes acting in the usual way (i.e., on both primal and dual parts), then we recommend making your own data type which wraps a dual number.
References:
- [1] https://en.wikipedia.org/wiki/Dual_number
- [2] https://blog.demofox.org/2014/12/30/dual-numbers-automatic-differentiation/
- [3] https://hackage.haskell.org/package/ad
Structs
DUAL :A
[STRUCT]
PRIMAL-PART :: :A
The primal part.DUAL-PART :: :A
The dual part.
Representation of a dual number in the form a + bε
where a
and b
are real numbers and ε
satisfies ε^2 = 0
and ε != 0
.
Note: Eq
, and Ord
and Hash
only make use of the primal component.
Instances
(NUM :A) (EXPONENTIABLE :A) (RECIPROCABLE :A) ⇒ EXPONENTIABLE (
DUAL
:A)(NUM :A) (RADICAL :A) (RECIPROCABLE :A) (EXPONENTIABLE :A) ⇒ RADICAL (
DUAL
:A)(NUM :A) (TRIGONOMETRIC :A) (RECIPROCABLE :A) (RADICAL :A) ⇒ TRIGONOMETRIC (
DUAL
:A)EQ :A ⇒ EQ (
DUAL
:A)
Note: Eq only compares the primal component.HASH :A ⇒ HASH (
DUAL
:A)
Note: Hash only considers the primal component in order to be consistent with Eq.NUM :A ⇒ NUM (
DUAL
:A)ORD :A ⇒ ORD (
DUAL
:A)
Note: Ord only compares the primal component.RECIPROCABLE :A ⇒ RECIPROCABLE (
DUAL
:A)RUNTIMEREPR (
DUAL
:A)
Values
(DUAL-PART (DUAL _ D))
[FUNCTION]
∀ :A. ((
DUAL
:A) → :A)
The dual (i.e., derivative) part of a dual number.
(PRIMAL-PART (DUAL P _))
[FUNCTION]
∀ :A. ((
DUAL
:A) → :A)
The primal (i.e., real) part of a dual number.
Package COALTON-LIBRARY/MATH/DYADIC
Types
DYADIC
[TYPE]
(Dyadic n k)
represents the rational n*2^k.
Instances
Values
(SCALE X J)
[FUNCTION]
Scales the exponent of a dyadic X by J.
(SHIFT K A)
[FUNCTION]
Shift dyadic A to its floor with K+1 bits of precision.
(SIMPLIFY D)
[FUNCTION]
Simplifies a Dyadic by maximizing the absolute value of the exponent.
(SIMPLIFY-INTEGER N)
[FUNCTION]
Finds the simplest dyadic given an integer
Package COALTON-LIBRARY/MATH/ELEMENTARY
Classes
ELEMENTARY
[CLASS]
(RECIPROCABLE :A) (POLAR :A) (TRIGONOMETRIC :A) (EXPONENTIABLE :A) (RADICAL :A) ⇒ ELEMENTARY :A
Elementary
is a marker class, providing Reciprocable
, Polar
, Trigonometric
, Exponentiable
, and Radical
.
Methods:
Instances
EXPONENTIABLE
[CLASS]
Exponential maps obeying:
(* (exp x) (exp y)) = (exp (+ x y))
(exp (ln x)) = x = (ln (exp x))
(log b x) = (/ (ln x) (ln b))
(pow x y) = (exp (* y (ln x)))
Methods:
EXP :: (:A → :A)
POW :: (:A → :A → :A)
LN :: (:A → :A)
LOG :: (:A → :A → :A)
EE :: :A
Instances
EXPONENTIABLE
CREAL
EXPONENTIABLE
BIG-FLOAT
(NUM :A) (EXPONENTIABLE :A) (RECIPROCABLE :A) ⇒ EXPONENTIABLE (
DUAL
:A)ELEMENTARY :A ⇒ EXPONENTIABLE (
COMPLEX
:A)EXPONENTIABLE
DOUBLE-FLOAT
EXPONENTIABLE
SINGLE-FLOAT
POLAR
[CLASS]
(COMPLEX :A) (NUM :A) ⇒ POLAR :A
For a complex number z = (complex x y)
, the following identities hold:
z = (* (magnitude z) (exp (* ii (phase z))))
(polar z) = (Tuple (magnitude z) (phase z))
(phase z) = (atan2 y x)
Methods:
Instances
POLAR
CREAL
POLAR
BIG-FLOAT
ELEMENTARY :A ⇒ POLAR (
COMPLEX
:A)POLAR
DOUBLE-FLOAT
POLAR
SINGLE-FLOAT
RADICAL
[CLASS]
RADICAL :A
Obeys:
(^ (sqrt x) 2) = x = (^^ (nth-root n x) n)
Methods:
NTH-ROOT :: (
INTEGER
→ :A → :A)SQRT :: (:A → :A)
Instances
RADICAL
CREAL
RADICAL
BIG-FLOAT
(NUM :A) (RADICAL :A) (RECIPROCABLE :A) (EXPONENTIABLE :A) ⇒ RADICAL (
DUAL
:A)ELEMENTARY :A ⇒ RADICAL (
COMPLEX
:A)RADICAL
DOUBLE-FLOAT
RADICAL
SINGLE-FLOAT
TRIGONOMETRIC
[CLASS]
Standard circular functions and their inverses.
Methods:
SIN :: (:A → :A)
COS :: (:A → :A)
TAN :: (:A → :A)
ASIN :: (:A → :A)
ACOS :: (:A → :A)
ATAN :: (:A → :A)
PI :: :A
Instances
TRIGONOMETRIC
CREAL
TRIGONOMETRIC
BIG-FLOAT
(NUM :A) (TRIGONOMETRIC :A) (RECIPROCABLE :A) (RADICAL :A) ⇒ TRIGONOMETRIC (
DUAL
:A)ELEMENTARY :A ⇒ TRIGONOMETRIC (
COMPLEX
:A)TRIGONOMETRIC
DOUBLE-FLOAT
TRIGONOMETRIC
SINGLE-FLOAT
Values
(ACOSH X)
[FUNCTION]
∀ :A. ELEMENTARY :A ⇒ (:A → :A)
(ASINH X)
[FUNCTION]
∀ :A. ELEMENTARY :A ⇒ (:A → :A)
(ATAN2 Y X)
[FUNCTION]
∀ :A. (ORD :A) (TRIGONOMETRIC :A) (RECIPROCABLE :A) ⇒ (:A → :A → :A)
Computes the two-argument arctangent of y and x, which is roughly the same as (atan (/ y x)) when defined and accounting for the quadrant of the (x,y).
(ATANH X)
[FUNCTION]
∀ :A. ELEMENTARY :A ⇒ (:A → :A)
(CIS Z)
[FUNCTION]
∀ :A. (TRIGONOMETRIC :A) (COMPLEX :A) ⇒ (:A → (
COMPLEX
:A))
A point on the complex unit circle:
(cis z) := (exp (complex 0 z))
= (complex (cos z) (sin z))
(COSH X)
[FUNCTION]
∀ :A. ELEMENTARY :A ⇒ (:A → :A)
(MAGNITUDE Z)
[FUNCTION]
∀ :A. (RADICAL :A) (COMPLEX :A) ⇒ ((
COMPLEX
:A) → :A)
For z = x + yi
,
(magnitude z) = (sqrt (+ (^ x 2) (^ y 2)))
(SINCOS X)
[FUNCTION]
∀ :A. TRIGONOMETRIC :A ⇒ (:A → (
TUPLE
:A :A))
Computes the sine and cosine of X.
(SINH X)
[FUNCTION]
∀ :A. ELEMENTARY :A ⇒ (:A → :A)
(TANH X)
[FUNCTION]
∀ :A. ELEMENTARY :A ⇒ (:A → :A)
Package COALTON-LIBRARY/MATH/FRACTION
Values
(DENOMINATOR Q)
[FUNCTION]
The denominator of a fraction.
(MKFRACTION A B)
[FUNCTION]
(
INTEGER
→ INTEGER
→ FRACTION
)
(NUMERATOR Q)
[FUNCTION]
The numerator of a fraction.
Package COALTON-LIBRARY/MATH/INTEGRAL
Classes
INTEGRAL
[CLASS]
(REMAINDER :A) (ORD :A) ⇒ INTEGRAL :A
Integral is a number that is either even or odd where div
and quot
are floored and truncated division, respectively.
Methods:
TOINTEGER :: (:A →
INTEGER
)
Instances
REMAINDER
[CLASS]
Remainder is typically an integral domain satisfying:
a = (+ (* b (quot a b)) (rem a b))
a = (+ (* b (div a b)) (mod a b))
Methods:
QUOT :: (:A → :A → :A)
REM :: (:A → :A → :A)
QUOTREM :: (:A → :A → (
TUPLE
:A :A))DIV :: (:A → :A → :A)
MOD :: (:A → :A → :A)
DIVMOD :: (:A → :A → (
TUPLE
:A :A))
Instances
Values
(EVEN? N)
[FUNCTION]
∀ :A. INTEGRAL :A ⇒ (:A →
BOOLEAN
)
Is N even?
(GCD A B)
[FUNCTION]
∀ :A. (REMAINDER :A) (ORD :A) ⇒ (:A → :A → :A)
The greatest common divisor of A and B.
(ILOG B X)
[FUNCTION]
∀ :A. INTEGRAL :A ⇒ (:A → :A → :A)
The floor of the logarithm with base B > 1 of X >= 1.
(INTEGRAL->NUM N)
[FUNCTION]
∀ :A :B. (INTEGRAL :A) (NUM :B) ⇒ (:A → :B)
Converts any Integral N into any Num.
(ISQRT X)
[FUNCTION]
∀ :A. INTEGRAL :A ⇒ (:A → :A)
The floor of the square root of N > 0.
(LCM A B)
[FUNCTION]
∀ :A. (REMAINDER :A) (ORD :A) ⇒ (:A → :A → :A)
The least common multiple of A and B.
(LSH X N)
[FUNCTION]
∀ :A :B. (INTEGRAL :B) (BITS :A) ⇒ (:A → :B → :A)
Left shift X by N
(ODD? N)
[FUNCTION]
∀ :A. INTEGRAL :A ⇒ (:A →
BOOLEAN
)
Is N odd?
(RSH X N)
[FUNCTION]
∀ :A :B. (INTEGRAL :B) (BITS :A) ⇒ (:A → :B → :A)
Right shift X by N
(^ BASE POWER)
[FUNCTION]
∀ :A :B. (NUM :A) (INTEGRAL :B) ⇒ (:A → :B → :A)
Exponentiate BASE to a non-negative POWER.
(^^ BASE POWER)
[FUNCTION]
∀ :A :B. (RECIPROCABLE :A) (INTEGRAL :B) ⇒ (:A → :B → :A)
Exponentiate BASE to a signed POWER.
Package COALTON-LIBRARY/MATH/REAL
Structs
QUANTIZATION :A
[STRUCT]
VALUE :: :A
A value of type:a
.FLOOR :: COALTON:INTEGER
The greatest integer less than or equal to a particular value.FLOOR-REM :: :A
The remainder of the floor operation as type:a
.CEILING :: COALTON:INTEGER
The least integer greater than or equal to a particular value.CEILING-REM :: :A
The remainder of the ceiling operation as type:a
.
Represents an integer quantization of :a
.
Instances
RUNTIMEREPR (
QUANTIZATION
:A)
Classes
QUANTIZABLE
[CLASS]
QUANTIZABLE :A
The representation of a type that allows for rounding operations
max x such that (floor x) <= x
min x such that (ceiling x) <= x
And
(proper x) = (Tuple (truncate x) (- x (truncate x)))
where
(truncate x) = (* (sign x) (floor (abs x))
Methods:
Instances
RATIONAL
[CLASS]
(REAL :A) (ORD :A) ⇒ RATIONAL :A
Any number that can be exactly represented by a fraction, or is not finite.
If a rational can be converted from a fraction it must satisfy:
(into (to-fraction x)) = x
(into (best-approx x)) = x
Furthermore, best-approx
returns the simplest fraction, and both functions may be partial.
Methods:
Instances
REAL
[CLASS]
(QUANTIZABLE :A) (NUM :A) ⇒ REAL :A
A real number that can be approximated with abs(real-approx x - x) < 2^-n.
Methods:
Instances
Values
(CEILING/ A B)
[FUNCTION]
Divide two integers and compute the ceiling of the quotient.
(EXACT/ A B)
[FUNCTION]
(
INTEGER
→ INTEGER
→ FRACTION
)
Exactly divide two integers and produce a fraction.
(FLOOR/ A B)
[FUNCTION]
Divide two integers and compute the floor of the quotient.
(FROMFRAC Q)
[FUNCTION]
∀ :A. DIVIDABLE
INTEGER
:A ⇒ (FRACTION
→ :A)
Converts a fraction to a target type.
Specifically, target types must have an instance of Dividable Integer :a
.
This conversion may result in loss of fidelity.
(INEXACT/ A B)
[FUNCTION]
(
INTEGER
→ INTEGER
→ DOUBLE-FLOAT
)
Compute the quotient of integers as a double-precision float.
Note: This does not divide double-float arguments.
(QUANTIZE X)
[FUNCTION]
∀ :A. REAL :A ⇒ (:A → (
QUANTIZATION
:A))
Given X, (QUANTIZE X) will return the least integer greater or equal to X, and the greatest integer less than or equal to X, along with their respective remainders expressed as values of type of X.
(ROUND X)
[FUNCTION]
∀ :A. (QUANTIZABLE :A) (NUM :A) ⇒ (:A →
INTEGER
)
Return the nearest integer to X, with ties breaking towards even numbers.
(ROUND-HALF-DOWN X)
[FUNCTION]
∀ :A. (QUANTIZABLE :A) (NUM :A) ⇒ (:A →
INTEGER
)
Return the nearest integer to X, with ties breaking toward positive infinity.
(ROUND-HALF-UP X)
[FUNCTION]
∀ :A. (QUANTIZABLE :A) (NUM :A) ⇒ (:A →
INTEGER
)
Return the nearest integer to X, with ties breaking toward positive infinity.
(ROUND/ A B)
[FUNCTION]
Divide two integers and round the quotient.
(SAFE/ X Y)
[FUNCTION]
∀ :A :B. (NUM :A) (DIVIDABLE :A :B) ⇒ (:A → :A → (
OPTIONAL
:B))
Safely divide X by Y, returning None if Y is zero.
(TRUNCATE X)
[FUNCTION]
∀ :A. QUANTIZABLE :A ⇒ (:A →
INTEGER
)
Returns the integer closest/equal to x
that is within 0
and x
.
Package COALTON-LIBRARY/MONAD/FREE
Types
FREE
[TYPE]
Free :f
gives you a Monad instance for any Functor :f
.
Instances
FOLDABLE :A ⇒ FOLDABLE (
FREE
:A)FUNCTOR :A ⇒ APPLICATIVE (
FREE
:A)FUNCTOR :A ⇒ FUNCTOR (
FREE
:A)FUNCTOR :A ⇒ MONAD (
FREE
:A)RUNTIMEREPR ((
FREE
:A) :B)TRAVERSABLE :A ⇒ TRAVERSABLE (
FREE
:A)
Values
(FOLDFREE NAT FR)
[FUNCTION]
∀ :A :B :C. MONAD :C ⇒ (((:A ((
FREE
:A) :B)) → (:C ((FREE
:A) :B))) → ((FREE
:A) :B) → (:C :B))
Given a natural transformation, induce a Monad homomorphism from a free monad to a target monad.
(LIFTF F)
[FUNCTION]
∀ :A :B. FUNCTOR :A ⇒ ((:A :B) → ((
FREE
:A) :B))
Lift a Functor into the Free Monad.
Package COALTON-LIBRARY/MONAD/STATE
Types
ST
[TYPE]
A computation of a value which may affect the state. Represented as a closure from initial state to updated state and value.
Instances
APPLICATIVE (
ST
:A)FUNCTOR (
ST
:A)MONAD (
ST
:A)RUNTIMEREPR (
ST
:A :B)
Values
(PUT STATE)
[FUNCTION]
A StatefulComputation with state set to be given state. The returned value is Unit.
(RUN SC)
[FUNCTION]
∀ :A :B. ((
ST
:A :B) → :A → (TUPLE
:A :B))
Runs a StatefulComputation to produce a final updated state and value given an initial state
GET
[VALUE]
∀ :A. (
ST
:A :A)
A StatefulComputation which returns the current state as the value.
Package COALTON-LIBRARY/OPTIONAL
Values
(FROM-SOME STR OPT)
[FUNCTION]
∀ :A. (
STRING
→ (OPTIONAL
:A) → :A)
Get the value of OPT, erroring with the provided string if it is None.
(NONE? X)
[FUNCTION]
∀ :A. ((
OPTIONAL
:A) → BOOLEAN
)
Is X None?
(SOME? X)
[FUNCTION]
∀ :A. ((
OPTIONAL
:A) → BOOLEAN
)
Is X Some?
Package COALTON-LIBRARY/ORD-MAP
Types
MAP
[TYPE]
A red-black binary tree which associates each :KEY with a :VALUE, sorted by <=>' on the keys and unique by
==’ on the keys.
Instances
Values
(COLLECT COLL)
[FUNCTION]
∀ :A :B :C. (ORD :B) (FOLDABLE :A) ⇒ ((:A (
TUPLE
:B :C)) → (MAP
:B :C))
Construct a Map
containing all the (key value)
pairs in coll
.
If coll
contains duplicate keys, later values will overwrite earlier values.
(COLLECT! ITER)
[FUNCTION]
∀ :A :B. ORD :A ⇒ ((
ITERATOR
(TUPLE
:A :B)) → (MAP
:A :B))
Construct a Map
containing all the (key value)
pairs in iter
.
If iter
contains duplicate keys, later values will overwrite earlier values.
(ENTRIES MP)
[FUNCTION]
∀ :A :B. ((
MAP
:A :B) → (ITERATOR
(TUPLE
:A :B)))
Iterate over the (key value) pairs in MP, sorted by the keys in least-to-greatest order.
(INSERT MP K V)
[FUNCTION]
∀ :A :B. ORD :A ⇒ ((
MAP
:A :B) → :A → :B → (OPTIONAL
(MAP
:A :B)))
Associate K with V in MP. If MP already contains a mapping for K, return None.
(INSERT-OR-REPLACE MP K V)
[FUNCTION]
∀ :A :B. ORD :A ⇒ ((
MAP
:A :B) → :A → :B → (MAP
:A :B))
Update MP to associate K with V.
If MP already contains a mapping for K, replace it and discard the old value.
Like `replace-or-insert’, but prioritizing insertion as a use case.
(KEYS MP)
[FUNCTION]
∀ :A :B. ((
MAP
:A :B) → (ITERATOR
:A))
Iterate over the keys in MP, sorted least-to-greatest.
(LOOKUP MP K)
[FUNCTION]
∀ :A :B. ORD :A ⇒ ((
MAP
:A :B) → :A → (OPTIONAL
:B))
Retrieve the value associated with K in MP, or None if MP does not contain K.
(MERGE A B)
[FUNCTION]
∀ :A :B. ORD :A ⇒ ((
MAP
:A :B) → (MAP
:A :B) → (MAP
:A :B))
Construct a Tree containing all the mappings of both A and B.
If A and B contain mappings X -> A’ and X -> B’, it is undefined whether the result maps X to A’ or B’.
Because of the possibility that A and B will map the same X to different A’ and B’, this is not an associative operation, and therefore Map cannot implement Monoid.
(REMOVE MP K)
[FUNCTION]
∀ :A :B. ORD :A ⇒ ((
MAP
:A :B) → :A → (OPTIONAL
(MAP
:A :B)))
Remove the mapping associated with K in MP. If K does not have a value in MP, return None.
(REPLACE MP K V)
[FUNCTION]
∀ :A :B. ORD :A ⇒ ((
MAP
:A :B) → :A → :B → (OPTIONAL
(TUPLE
(MAP
:A :B) :B)))
Change the association of K to V in MP. If MP did not already contain a mapping for K, return None.
(REPLACE-OR-INSERT MP K V)
[FUNCTION]
∀ :A :B. ORD :A ⇒ ((
MAP
:A :B) → :A → :B → (TUPLE
(MAP
:A :B) (OPTIONAL
:B)))
Update MP to associate K with V.
If MP already contains a mapping for K, replace it and return the old value.
(UPDATE FUNC MP KEY)
[FUNCTION]
∀ :A :B. ORD :B ⇒ ((:A → :A) → (
MAP
:B :A) → :B → (OPTIONAL
(MAP
:B :A)))
Apply FUNC to the value corresponding to KEY in MP, returning a new `Map’ which maps KEY to the result of the function.
(VALUES MP)
[FUNCTION]
∀ :A :B. ((
MAP
:A :B) → (ITERATOR
:B))
Iterate over the values in MP, sorted by their corresponding keys in least-to-greatest order.
EMPTY
[VALUE]
∀ :A :B. (
MAP
:A :B)
A Map containing no mappings.
Package COALTON-LIBRARY/ORD-TREE
Types
TREE
[TYPE]
DOUBLEBLACKEMPTY
(BRANCH
COLOR
(TREE
:A) :A (TREE
:A) unexported; a tree with at least one element, and possibly children. (Branch clr less elt right). Every element of LESS is less than ELT, and every element of RIGHT is greater than ELT.)
A red-black balanced binary tree, sorted by <=>
and unique by ==
.
Instances
Values
(COLLECT! ITER)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
ITERATOR
:A) → (TREE
:A))
Construct a Tree containing all the elements of ITER.
If ITER contains duplicates, later elements will overwrite earlier elements.
(DECREASING-ORDER)
[FUNCTION]
∀ :A. ((
TREE
:A) → (ITERATOR
:A))
Iterate the elements of a tree, starting with the greatest by `<=>’ and ending with the least.
(INCREASING-ORDER)
[FUNCTION]
∀ :A. ((
TREE
:A) → (ITERATOR
:A))
Iterate the elements of a tree, starting with the least by `<=>’ and ending with the greatest.
(INSERT TRE ELT)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
TREE
:A) → :A → (OPTIONAL
(TREE
:A)))
Construct a new Tree like TRE but containing ELT. If TRE already had an element ==
to ELT, return None.
(INSERT-OR-REPLACE TRE ELT)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
TREE
:A) → :A → (TREE
:A))
Construct a new Tree like TRE but containing ELT.
If TRE already had an element ==
to ELT, remove it, replace it with ELT, and discard the removed value.
Like replace-or-insert
, but prioritizing insertion as a use case.
(LOOKUP HAYSTACK NEEDLE)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
TREE
:A) → :A → (OPTIONAL
:A))
If HAYSTACK contains an element ==
to NEEDLE, return it.
(MERGE A B)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
TREE
:A) → (TREE
:A) → (TREE
:A))
Construct a Tree containing all the elements of both A and B.
If A and B contain elements A’ and B’ respectively where (== A’ B’), the result will contain either A’ or B’. Which one is chosen for the result is undefined.
(REMOVE TRE ELT)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
TREE
:A) → :A → (OPTIONAL
(TREE
:A)))
Construct a new Tree like TRE but without an element ==' to ELT. Return None if TRE does not contain an element
==` to ELT.
(REPLACE TRE ELT)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
TREE
:A) → :A → (OPTIONAL
(TUPLE
(TREE
:A) :A)))
Construct a new Tree like TRE but with ELT replacing an old element ==
to ELT.
Return the new tree and the removed element.
If TRE did not have an element `==’ to ELT, return None.
(REPLACE-OR-INSERT TRE ELT)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
TREE
:A) → :A → (TUPLE
(TREE
:A) (OPTIONAL
:A)))
Construct a new Tree like TRE but containing ELT.
If TRE already had an element ==
to ELT, remove it, replace it with ELT, and return the removed value
alongside the new tree.
Package COALTON-LIBRARY/QUEUE
Types
QUEUE
[TYPE]
Unbounded FIFO queue implemented with a linked list.
Instances
Values
(APPEND Q1 Q2)
[FUNCTION]
∀ :A. ((
QUEUE
:A) → (QUEUE
:A) → (QUEUE
:A))
Create a new queue containing the elements of q1
followed by the elements of q2
.
(CLEAR! Q)
[FUNCTION]
Clear all elements from q
.
(COPY Q)
[FUNCTION]
∀ :A. ((
QUEUE
:A) → (QUEUE
:A))
Return a new queue containing the same elements as q
.
(EMPTY? Q)
[FUNCTION]
Is q
empty?
(EXTEND! Q ITER)
[FUNCTION]
∀ :A :B. INTOITERATOR :B :A ⇒ ((
QUEUE
:A) → :B → UNIT
)
Push every element in iter
to the end of q
.
(INDEX INDEX Q)
[FUNCTION]
∀ :A. (
UFIX
→ (QUEUE
:A) → (OPTIONAL
:A))
Return the index
th element of q
.
(INDEX-UNSAFE INDEX Q)
[FUNCTION]
∀ :A. (
UFIX
→ (QUEUE
:A) → :A)
Return the index
th element of q
without checking if the element exists.
(ITEMS! Q)
[FUNCTION]
∀ :A. ((
QUEUE
:A) → (ITERATOR
:A))
Returns an interator over the items of q
, removing items as they are returned.
(LENGTH Q)
[FUNCTION]
Returns the length of q
.
(NEW _)
[FUNCTION]
Create a new empty queue.
(PEEK Q)
[FUNCTION]
∀ :A. ((
QUEUE
:A) → (OPTIONAL
:A))
Peek at the first item of q
.
(PEEK-UNSAFE Q)
[FUNCTION]
∀ :A. ((
QUEUE
:A) → :A)
Peek at the first item of q
without checking if the queue is empty.
(POP! Q)
[FUNCTION]
∀ :A. ((
QUEUE
:A) → (OPTIONAL
:A))
Remove and return the first item of q
.
(POP-UNSAFE! Q)
[FUNCTION]
∀ :A. ((
QUEUE
:A) → :A)
Remove and return the first item of q
without checking if the queue is empty.
(PUSH! ITEM Q)
[FUNCTION]
∀ :A. (:A → (
QUEUE
:A) → UNIT
)
Push item
onto the end of q
.
Package COALTON-LIBRARY/RANDOMACCESS
Classes
RANDOMACCESS
[CLASS]
RANDOMACCESS :A :B
Establishes that :f
is a random-access store of elements of type :t
. The storage type :f
implies the stored type :t
. The storage is expected to be sequential and O(1) in random access reads and writes.
It is permitted for any of make
, unsafe-aref
, or unsafe-set!
to error.
Methods:
MAKE :: (
UFIX
→ :A → :B)LENGTH :: (:B →
UFIX
)READABLE? :: (:B →
BOOLEAN
)WRITABLE? :: (:B →
BOOLEAN
)UNSAFE-AREF :: (:B →
UFIX
→ :A)UNSAFE-SET! :: (:B →
UFIX
→ :A →UNIT
)
Instances
RANDOMACCESS (
VECTOR
:A) :A
Values
(AREF STORAGE INDEX)
[FUNCTION]
∀ :A :B. RANDOMACCESS :A :B ⇒ (:A →
UFIX
→ (OPTIONAL
:B))
Read the element at index
of the random-access storage storage
. Return None
if the read is out-of-bounds or not permitted.
(SET! STORAGE INDEX VALUE)
[FUNCTION]
∀ :A :B. RANDOMACCESS :A :B ⇒ (:A →
UFIX
→ :B → (OPTIONAL
UNIT
))
Write the element value
at index
of the random-access storage storage
. Return None
if the write is out-of-bounds or not permitted.
Package COALTON-LIBRARY/RESULT
Values
(ERR? X)
[FUNCTION]
∀ :A :B. ((
RESULT
:A :B) → BOOLEAN
)
Returns TRUE if X is ERR
(FLATTEN X)
[FUNCTION]
∀ :A. ((
RESULT
:A :A) → :A)
(MAP-ERR F X)
[FUNCTION]
∀ :A :B :C. ((:A → :B) → (
RESULT
:A :C) → (RESULT
:B :C))
Map over the ERR case
(OK-OR-ERROR RES)
[FUNCTION]
∀ :A :B. SIGNALABLE :A ⇒ ((
RESULT
:A :B) → :B)
(OK? X)
[FUNCTION]
∀ :A :B. ((
RESULT
:A :B) → BOOLEAN
)
Returns TRUE if X is OK
Package COALTON-LIBRARY/SEQ
Types
SEQ
[TYPE]
Instances
(FOLDABLE :A) (RUNTIMEREPR :B) ⇒ INTO (:A :B) (
SEQ
:B)EQ :A ⇒ EQ (
SEQ
:A)FUNCTOR
SEQ
INTO (
SEQ
:A) (LIST
:A)INTO (
SEQ
:A) (VECTOR
:A)INTOITERATOR (
SEQ
:A) :ARUNTIMEREPR (
SEQ
:A)RUNTIMEREPR :A ⇒ DEFAULT (
SEQ
:A)RUNTIMEREPR :A ⇒ FROMITERATOR (
SEQ
:A) :ARUNTIMEREPR :A ⇒ MONOID (
SEQ
:A)RUNTIMEREPR :A ⇒ SEMIGROUP (
SEQ
:A)
Values
(CONC LEFT RIGHT)
[FUNCTION]
∀ :A. RUNTIMEREPR :A ⇒ ((
SEQ
:A) → (SEQ
:A) → (SEQ
:A))
Concatenate two Seq
s
(EMPTY? SEQ)
[FUNCTION]
(GET SEQ IDX)
[FUNCTION]
∀ :A. ((
SEQ
:A) → UFIX
→ (OPTIONAL
:A))
Get the member of seq
at index idx
, or None
if idx
is larger
than (size seq)
(NEW _)
[FUNCTION]
∀ :A. RUNTIMEREPR :A ⇒ (
UNIT
→ (SEQ
:A))
Create a new empty Seq
.
(POP SEQ)
[FUNCTION]
∀ :A. ((
SEQ
:A) → (OPTIONAL
(TUPLE
:A (SEQ
:A))))
If seq
is empty, return None
. Otherwise, the last member of seq
and
a new Seq
instance.
(PUSH SEQ A)
[FUNCTION]
∀ :A. ((
SEQ
:A) → :A → (SEQ
:A))
Push a
onto the end of seq
, returning a new Seq
instance.
(PUT SEQ IDX A)
[FUNCTION]
∀ :A. ((
SEQ
:A) → UFIX
→ :A → (OPTIONAL
(SEQ
:A)))
If idx
is less than (size seq)
, Return a new seq
whose idx
position
contains a
.
(SIZE SEQ)
[FUNCTION]
Return the number of elements in the seq
.
Package COALTON-LIBRARY/SLICE
Types
SLICE
[TYPE]
Instances
Values
(INDEX IDX S)
[FUNCTION]
∀ :A. (
UFIX
→ (SLICE
:A) → (OPTIONAL
:A))
Lookup the element at index
in s
.
(INDEX-UNSAFE IDX S)
[FUNCTION]
∀ :A. (
UFIX
→ (SLICE
:A) → :A)
Lookup the element at index
in s
without bounds checking.
(ITER-CHUNKED SIZE S)
[FUNCTION]
∀ :A :B. SLICEABLE (:A :B) ⇒ (
UFIX
→ (:A :B) → (ITERATOR
(SLICE
:B)))
Divide s
into a series of slices of length size
. Will return a final shorter slice if s
does not divide evenly.
(ITER-CHUNKED-EXACT SIZE S)
[FUNCTION]
∀ :A :B. SLICEABLE (:A :B) ⇒ (
UFIX
→ (:A :B) → (ITERATOR
(SLICE
:B)))
Divide s
into a series of slices of length size
. Will skip trailing elements if s
does not divide evenly.
(ITER-SLIDING SIZE S)
[FUNCTION]
∀ :A :B. SLICEABLE (:A :B) ⇒ (
UFIX
→ (:A :B) → (ITERATOR
(SLICE
:B)))
Returns an iterator that yeilds a series of overlapping slices of length size
.
(LENGTH S)
[FUNCTION]
Returns the length of s
.
(NEW START LEN V)
[FUNCTION]
∀ :A :B. SLICEABLE (:A :B) ⇒ (
UFIX
→ UFIX
→ (:A :B) → (SLICE
:B))
Create a new slice backed by v
starting at index start
and continuing for len
elements.
(SET! IDX ITEM S)
[FUNCTION]
∀ :A. (
UFIX
→ :A → (SLICE
:A) → UNIT
)
Set the element at index idx
in s
to item
.
Package COALTON-LIBRARY/STRING
Values
(CHARS STR)
[FUNCTION]
Returns an iterator over the characters in str
.
(CONCAT STR1 STR2)
[FUNCTION]
Concatenate STR1 and STR2 together, returning a new string.
(LENGTH STR)
[FUNCTION]
The length of a string STR.
(PARSE-INT STR)
[FUNCTION]
Parse the integer in string str
.
(REF STR IDX)
[FUNCTION]
(
STRING
→ UFIX
→ (OPTIONAL
CHAR
))
Return the idx
th character of str
.
(REF-UNCHECKED STR IDX)
[FUNCTION]
Return the idx
th character of str
. This function is partial.
(REVERSE S)
[FUNCTION]
Reverse a string.
(SPLIT N STR)
[FUNCTION]
(
UFIX
→ STRING
→ (TUPLE
STRING
STRING
))
Splits a string into a head and tail at the nth index.
(STRIP-PREFIX PREFIX STR)
[FUNCTION]
(
STRING
→ STRING
→ (OPTIONAL
STRING
))
Returns a string without a give prefix, or None
if the string
does not have that suffix.
(STRIP-SUFFIX SUFFIX STR)
[FUNCTION]
(
STRING
→ STRING
→ (OPTIONAL
STRING
))
Returns a string without a give suffix, or None
if the string
does not have that suffix.
(SUBSTRING STR START END)
[FUNCTION]
(
STRING
→ UFIX
→ UFIX
→ STRING
)
Compute a substring of a string bounded by given indices.
(SUBSTRING-INDEX SMALL BIG)
[FUNCTION]
(
STRING
→ STRING
→ (OPTIONAL
UFIX
))
If the first argument appears as a substring within the second argument, return the starting index into the second argument.
(SUBSTRING? SMALL BIG)
[FUNCTION]
Return true if the first argument appears as a substring within the second argument.
Package COALTON-LIBRARY/SYSTEM
Types
LISPCONDITION
[TYPE]
Condition for lisp error handling. Uses cl:condition
.
Instances
Structs
METEREDRESULT :A
[STRUCT]
RESULT :: :A
The result of the function.TIME-ELAPSED :: COALTON:INTEGER
The real time elapsed running the function (in internal time units).BYTES-CONSED :: (COALTON-LIBRARY/CLASSES:OPTIONAL COALTON:INTEGER)
The number of bytes consed during the run.
Function output with space and timing metedata.
Instances
RUNTIMEREPR (
METEREDRESULT
:A)
Values
(ADD-FEATURE FEAT)
[FUNCTION]
Adds a feature feat
to cl:*features*
.
(ARCHITECTURE _)
[FUNCTION]
The system’s architecture (stored at compile time).
(ARGV0 _)
[FUNCTION]
The first command line argument (stored at compile time).
(CMD-ARGS _)
[FUNCTION]
The current command line arguments (stored at compile time).
(FEATURES _)
[FUNCTION]
Returns a list of active features, from cl:*features*
.
(GC _)
[FUNCTION]
Perform a full garbage collection.
(GET-REAL-TIME _)
[FUNCTION]
Gets the real-time in internal time units. The difference between two successive calls to this function represents the time that has elapsed.
(GETENV VAR)
[FUNCTION]
Gets the value of the environmental variable var
, errors if var
doesn’t exist.
(HOSTNAME _)
[FUNCTION]
Returns the system’s hostname. This is a function because the hostname can be redefined.
(IMPLEMENTATION _)
[FUNCTION]
The lisp implementation (stored at compile time).
(LISP-VERSION _)
[FUNCTION]
The lisp implementation version (stored at compile time).
(MONOTONIC-BYTES-CONSED _)
[FUNCTION]
Returns the number of bytes consed since some unspecified point in time.
The difference between two successive calls to this function represents the number of bytes consed in that period of time.
(OS _)
[FUNCTION]
The system’s operating system (stored at compile time).
(SETENV! VAR VAL)
[FUNCTION]
Sets an environment variable var
to string val
, only if var
already exists.
(SLEEP N)
[FUNCTION]
∀ :A. RATIONAL :A ⇒ (:A →
UNIT
)
Sleep for n
seconds, where n
can be of any type with an instance of Rational
.
Sleep uses type class Rational
’s best-approx
instead of Real
’s real-approx
because it handles the approximation without arbitrary precision. The only Real
type excluded by this decision is CReal
.
(SPACE F)
[FUNCTION]
∀ :A. ((
UNIT
→ :A) → (TUPLE
:A (OPTIONAL
INTEGER
)))
Run the thunk f
and return a tuple containing its value along with the approximate number of bytes consed during the course of executing f.
The amount of space used may be peculiar to the implementation, such as rounding to certain page boundaries.
A garbage collection will be forced prior to invoking f
.
(SPACETIME F)
[FUNCTION]
∀ :A. ((
UNIT
→ :A) → (METEREDRESULT
:A))
Runs a function, gathering space and timing information and returning a MeteredResults
object.
Garbage collection will be performed before profiling is performed.
(TIME F)
[FUNCTION]
∀ :A. ((
UNIT
→ :A) → (TUPLE
:A INTEGER
))
Run the thunk f
and return a tuple containing its value along with the run time in microseconds.
While the result will always contain microseconds, some implementations may return a value rounded to less precision (e.g., rounded to the nearest second or millisecond).
(TIME-UNITS->ROUNDED-MICROSECONDS T)
[FUNCTION]
Converts internal time units into an integer number of rounded microseconds.
(TIME-UNITS->SECONDS T)
[FUNCTION]
Converts internal time units into Fraction
seconds.
INTERNAL-TIME-UNITS-PER-SECOND
[VALUE]
The number of internal time units per second. This is implementation specific.
Package COALTON-LIBRARY/TUPLE
Structs
TUPLE3 :A :B :C
[STRUCT]
FIRST :: :A
SECOND :: :B
THIRD :: :C
Instances
TUPLE4 :A :B :C :D
[STRUCT]
FIRST :: :A
SECOND :: :B
THIRD :: :C
FOURTH :: :D
Instances
TUPLE5 :A :B :C :D :E
[STRUCT]
FIRST :: :A
SECOND :: :B
THIRD :: :C
FOURTH :: :D
FIFTH :: :E
Instances
Values
(FST (TUPLE A _))
[FUNCTION]
∀ :A :B. ((
TUPLE
:A :B) → :A)
Get the first element of a tuple.
(SND (TUPLE _ B))
[FUNCTION]
∀ :A :B. ((
TUPLE
:A :B) → :B)
Get the second element of a tuple.
Package COALTON-LIBRARY/TYPES
Types
LISPTYPE
[TYPE]
The runtime representation of a Coalton type as a lisp type.
Instances
PROXY
[TYPE]
Proxy holds no data, but has a phantom type parameter.
Instances
RUNTIMEREPR (
PROXY
:A)
Classes
RUNTIMEREPR
[CLASS]
RUNTIMEREPR :A
Types which have a runtime LispType representation.
runtime-repr
corresponds to the type emitted by the Coalton compiler for the type parameter to the given Proxy.
The compiler will auto-generate instances of RuntimeRepr
for all defined types.
Methods:
Instances
RUNTIMEREPR
CREAL
RUNTIMEREPR
BIG-FLOAT
RUNTIMEREPR
ROUNDINGMODE
RUNTIMEREPR
STREAMOPTIONS
RUNTIMEREPR
IFEXISTS
RUNTIMEREPR (
FILESTREAM
:A)RUNTIMEREPR
FILEERROR
RUNTIMEREPR
PATHNAME
RUNTIMEREPR
LISPCONDITION
RUNTIMEREPR (
METEREDRESULT
:A)RUNTIMEREPR (
SEQ
:A)RUNTIMEREPR ((
FREE
:A) :B)RUNTIMEREPR (
MAP
:A :B)RUNTIMEREPR (
MAPPAIR
:A :B)RUNTIMEREPR (
ITERATORSTACKNODE
:A)RUNTIMEREPR (
TREE
:A)RUNTIMEREPR
COLOR
RUNTIMEREPR (
ST
:A :B)RUNTIMEREPR (
QUEUE
:A)RUNTIMEREPR (
HASHTABLE
:A :B)RUNTIMEREPR (
SLICE
:A)RUNTIMEREPR (
VECTOR
:A)RUNTIMEREPR (
LISPARRAY
:A)RUNTIMEREPR (
ITERATOR
:A)RUNTIMEREPR (
TUPLE5
:A :B :C :D :E)RUNTIMEREPR (
TUPLE4
:A :B :C :D)RUNTIMEREPR (
TUPLE3
:A :B :C)RUNTIMEREPR (
CELL
:A)RUNTIMEREPR (
DUAL
:A)RUNTIMEREPR
DYADIC
RUNTIMEREPR (
COMPLEX
:A)RUNTIMEREPR (
QUANTIZATION
:A)RUNTIMEREPR
HASH
RUNTIMEREPR (
TUPLE
:A :B)RUNTIMEREPR
ORD
RUNTIMEREPR (
RESULT
:A :B)RUNTIMEREPR (
OPTIONAL
:A)RUNTIMEREPR
UFIX
RUNTIMEREPR
IFIX
RUNTIMEREPR
I64
RUNTIMEREPR
I32
RUNTIMEREPR
I16
RUNTIMEREPR
I8
RUNTIMEREPR
U64
RUNTIMEREPR
U32
RUNTIMEREPR
U16
RUNTIMEREPR
U8
RUNTIMEREPR
VOID
RUNTIMEREPR (
PROXY
:A)RUNTIMEREPR
LISPTYPE
RUNTIMEREPR (
LIST
:A)RUNTIMEREPR (:A → :B)
RUNTIMEREPR
FRACTION
RUNTIMEREPR
STRING
RUNTIMEREPR
DOUBLE-FLOAT
RUNTIMEREPR
SINGLE-FLOAT
RUNTIMEREPR
INTEGER
RUNTIMEREPR
CHAR
RUNTIMEREPR
BOOLEAN
Values
(AS-PROXY-OF X _)
[FUNCTION]
∀ :A. (:A → (
PROXY
:A) → :A)
Returns the parameter, forcing the proxy to have the same type as the parameter.
(PROXY-INNER _)
[FUNCTION]
∀ :A :B. ((
PROXY
(:A :B)) → (PROXY
:B))
(PROXY-OF _)
[FUNCTION]
∀ :A. (:A → (
PROXY
:A))
Returns a Proxy containing the type of the parameter.
(RUNTIME-REPR-OF X)
[FUNCTION]
∀ :A. RUNTIMEREPR :A ⇒ (:A →
LISPTYPE
)
Returns the runtime representation of the type of the given value.
Package COALTON-LIBRARY/VECTOR
Types
VECTOR
[TYPE]
Instances
DEFAULT (
VECTOR
:A)EQ :A ⇒ EQ (
VECTOR
:A)FOLDABLE
VECTOR
FROMITERATOR (
VECTOR
:A) :AFUNCTOR
VECTOR
INTO (
LIST
:A) (VECTOR
:A)INTO (
SEQ
:A) (VECTOR
:A)INTO (
SLICE
:A) (VECTOR
:A)INTO (
VECTOR
:A) (LIST
:A)INTO (
VECTOR
:A) (SLICE
:A)INTOITERATOR (
VECTOR
:A) :AISO (
SLICE
:A) (VECTOR
:A)ISO (
VECTOR
:A) (LIST
:A)RANDOMACCESS (
VECTOR
:A) :ARUNTIMEREPR (
VECTOR
:A)SEMIGROUP (
VECTOR
:A)SLICEABLE (
VECTOR
:A)
Values
(APPEND V1 V2)
[FUNCTION]
∀ :A. ((
VECTOR
:A) → (VECTOR
:A) → (VECTOR
:A))
Create a new vector containing the elements of v1
followed by the elements of v2
.
(CAPACITY V)
[FUNCTION]
Returns the number of elements that v
can store without resizing.
(CLEAR! V)
[FUNCTION]
Set the capacity of v
to 0
.
(COPY V)
[FUNCTION]
∀ :A. ((
VECTOR
:A) → (VECTOR
:A))
Return a new vector containing the same elements as v
.
(EMPTY? V)
[FUNCTION]
Is v
empty?
(EXTEND! VEC ITER)
[FUNCTION]
∀ :A :B. INTOITERATOR :B :A ⇒ ((
VECTOR
:A) → :B → UNIT
)
Push every element in iter
to the end of vec
.
(FIND-ELEM E V)
[FUNCTION]
∀ :A. EQ :A ⇒ (:A → (
VECTOR
:A) → (OPTIONAL
UFIX
))
Find the index of element e
in v
.
(HEAD V)
[FUNCTION]
∀ :A. ((
VECTOR
:A) → (OPTIONAL
:A))
Return the first item of v
.
(HEAD-UNSAFE V)
[FUNCTION]
∀ :A. ((
VECTOR
:A) → :A)
Return the first item of v
without first checking if v
is empty.
(INDEX INDEX V)
[FUNCTION]
∀ :A. (
UFIX
→ (VECTOR
:A) → (OPTIONAL
:A))
Return the index
th element of v
.
(INDEX-UNSAFE IDX V)
[FUNCTION]
∀ :A. (
UFIX
→ (VECTOR
:A) → :A)
Return the idx
th element of v
without checking if the element exists.
(LAST V)
[FUNCTION]
∀ :A. ((
VECTOR
:A) → (OPTIONAL
:A))
Return the last element of v
.
(LAST-UNSAFE V)
[FUNCTION]
∀ :A. ((
VECTOR
:A) → :A)
Return the last element of v
without first checking if v
is empty.
(LENGTH V)
[FUNCTION]
Returns the length of v
.
(NEW _)
[FUNCTION]
Create a new empty vector
(POP! V)
[FUNCTION]
∀ :A. ((
VECTOR
:A) → (OPTIONAL
:A))
Remove and return the last item of v
.
(POP-UNSAFE! V)
[FUNCTION]
∀ :A. ((
VECTOR
:A) → :A)
Remove and return the last item of v
without checking if the vector is empty.
(PUSH! ITEM V)
[FUNCTION]
∀ :A. (:A → (
VECTOR
:A) → UFIX
)
Append item
to v
and resize v
if necessary, returning the index of the new item.
(SET! IDX ITEM V)
[FUNCTION]
∀ :A. (
UFIX
→ :A → (VECTOR
:A) → UNIT
)
Set the idx
th element of v
to item
. This function left intentionally unsafe because it does not have a return value to check.
(SET-CAPACITY! NEW-CAPACITY V)
[FUNCTION]
∀ :A. (
UFIX
→ (VECTOR
:A) → UNIT
)
Set the capacity of v
to new-capacity
. Setting the capacity to lower then the length will remove elements from the end.
(SINGLETON X)
[FUNCTION]
∀ :A. (:A → (
VECTOR
:A))
Create a new vector with a single element equal to x
(SINGLETON? V)
[FUNCTION]
Is v
a singleton?
(SORT! V)
[FUNCTION]
∀ :A. ORD :A ⇒ ((
VECTOR
:A) → UNIT
)
Sort a vector in-place in ascending order.
(SORT-BY! F V)
[FUNCTION]
∀ :A. ((:A → :A →
BOOLEAN
) → (VECTOR
:A) → UNIT
)
Sort a vector in-place with predicate function f
.
(SWAP-REMOVE! IDX VEC)
[FUNCTION]
∀ :A. (
UFIX
→ (VECTOR
:A) → (OPTIONAL
:A))
Remove the element idx
from vec
and replace it with the last element in vec
. Then return the removed element.
(SWAP-REMOVE-UNSAFE! IDX VEC)
[FUNCTION]
∀ :A. (
UFIX
→ (VECTOR
:A) → :A)
Remove the element idx
from vec
and replace it with the last element in vec
without bounds checking. Then return the removed element.
(WITH-CAPACITY N)
[FUNCTION]
Create a new vector with n
elements preallocated.
(WITH-INITIAL-ELEMENT N X)
[FUNCTION]
∀ :A. (
UFIX
→ :A → (VECTOR
:A))
Create a new vector with n
elements equal to x
.