Package COALTON
Public interface to COALTON.
Types
ARROW [TYPE]
A named constructor for function types. Arrow :a :b is equivalent to :a -> :b.
Instances
APPLICATIVE (ARROW:A)FUNCTOR (ARROW:A)MONAD (ARROW:A)RUNTIMEREPR (:A → :B)
BIT [TYPE] · src
A single bit, equal to 0 or 1. Uses cl:bit.
Instances
BITSBITBOUNDEDBITDEFAULTBITEQBITHASHBITINTEGRALBITINTOBITF32INTOBITF64INTOBITFRACTIONINTOBITI16INTOBITI32INTOBITI64INTOBITI8INTOBITIFIXINTOBITINTEGERINTOBITU16INTOBITU32INTOBITU64INTOBITU8INTOBITUFIXNUMBITORDBITQUANTIZABLEBITRATIONALBITREALBITREMAINDERBITRUNTIMEREPRBITTRYINTOI16BITSTRINGTRYINTOI32BITSTRINGTRYINTOI64BITSTRINGTRYINTOI8BITSTRINGTRYINTOIFIXBITSTRINGTRYINTOINTEGERBITSTRINGTRYINTOU16BITSTRINGTRYINTOU32BITSTRINGTRYINTOU64BITSTRINGTRYINTOU8BITSTRINGTRYINTOUFIXBITSTRING
BOOLEAN [TYPE]
FALSE- Boolean
False
- Boolean
TRUE- Boolean
True
- Boolean
Either true or false, internally represented by cl:t and cl:nil respectively.
CHAR [TYPE]
A character represented by a Common Lisp cl:character.
Instances
DOUBLE-FLOAT [TYPE] · src
Deprecated name for F64. This is provided for backward compatibility.
F32 [TYPE]
Single-precision floating point number (32 bits in size). Represented by a Common Lisp cl:single-float.
Instances
COMPLEXCOMPONENTF32DEFAULTF32DIVIDABLEINTEGERF32ELEMENTARYF32EQF32EXPONENTIABLEF32HASHF32INTOBITF32INTOF32BIG-FLOATINTOF32CREALINTOF32STRINGINTOI16F32INTOI8F32INTOU16F32INTOU8F32NUMF32ORDF32POLARF32QUANTIZABLEF32RADICALF32RATIONALF32REALF32RECIPROCABLEF32REMAINDERF32RUNTIMEREPRF32TRANSFINITEF32TRIGONOMETRICF32TRYINTOF32FRACTIONSTRINGTRYINTOI32F32STRINGTRYINTOI64F32STRINGTRYINTOIFIXF32STRINGTRYINTOINTEGERF32STRINGTRYINTOU32F32STRINGTRYINTOU64F32STRINGTRYINTOUFIXF32STRING
F64 [TYPE]
Double-precision floating point number (64 bits in size). Represented by a Common Lisp cl:double-float.
Instances
COMPLEXCOMPONENTF64DEFAULTF64DIVIDABLEINTEGERF64ELEMENTARYF64EQF64EXPONENTIABLEF64HASHF64INTOBITF64INTOF64BIG-FLOATINTOF64CREALINTOF64STRINGINTOI16F64INTOI32F64INTOI8F64INTOU16F64INTOU32F64INTOU8F64NUMF64ORDF64POLARF64QUANTIZABLEF64RADICALF64RATIONALF64REALF64RECIPROCABLEF64REMAINDERF64RUNTIMEREPRF64TRANSFINITEF64TRIGONOMETRICF64TRYINTOF64FRACTIONSTRINGTRYINTOI64F64STRINGTRYINTOIFIXF64STRINGTRYINTOINTEGERF64STRINGTRYINTOU64F64STRINGTRYINTOUFIXF64STRING
FRACTION [TYPE]
A ratio of integers always in reduced form. Represented by a Common Lisp cl:rational.
Instances
COMPLEXCOMPONENTFRACTIONDIVIDABLEINTEGERFRACTIONEQFRACTIONINTOBITFRACTIONINTODYADICFRACTIONINTOFRACTIONBIG-FLOATINTOFRACTIONCREALINTOFRACTIONSTRINGINTOI16FRACTIONINTOI32FRACTIONINTOI64FRACTIONINTOI8FRACTIONINTOIFIXFRACTIONINTOINTEGERFRACTIONINTOU16FRACTIONINTOU32FRACTIONINTOU64FRACTIONINTOU8FRACTIONINTOUFIXFRACTIONNUMFRACTIONORDFRACTIONQUANTIZABLEFRACTIONRATIONALFRACTIONREALFRACTIONRECIPROCABLEFRACTIONREMAINDERFRACTIONRUNTIMEREPRFRACTIONTRYINTOF32FRACTIONSTRINGTRYINTOF64FRACTIONSTRING
I16 [TYPE] · src
Signed 16-bit integer capable of storing values in [-32768, 32767]. Uses (signed-byte 16).
Instances
%FILEBYTEI16BITSI16BOUNDEDI16DEFAULTI16EQI16FILEI16HASHI16INTEGRALI16INTOBITI16INTOI16CREALINTOI16F32INTOI16F64INTOI16FRACTIONINTOI16I32INTOI16I64INTOI16IFIXINTOI16INTEGERINTOI16STRINGINTOI8I16INTOU8I16NUMI16ORDI16REMAINDERI16RUNTIMEREPRI16TRYINTOI16BITSTRINGTRYINTOI16I8STRINGTRYINTOI16U16STRINGTRYINTOI16U32STRINGTRYINTOI16U64STRINGTRYINTOI16U8STRINGTRYINTOI16UFIXSTRINGTRYINTOI32I16STRINGTRYINTOI64I16STRINGTRYINTOIFIXI16STRINGTRYINTOINTEGERI16STRINGTRYINTOU16I16STRINGTRYINTOU32I16STRINGTRYINTOU64I16STRINGTRYINTOUFIXI16STRING
I32 [TYPE] · src
Signed 32-bit integer capable of storing values in [-2147483648, 2147483647]. Uses (signed-byte 32).
Instances
%FILEBYTEI32BITSI32BOUNDEDI32DEFAULTI32EQI32FILEI32HASHI32INTEGRALI32INTOBITI32INTOI16I32INTOI32CREALINTOI32F64INTOI32FRACTIONINTOI32I64INTOI32IFIXINTOI32INTEGERINTOI32STRINGINTOI8I32INTOU16I32INTOU8I32NUMI32ORDI32QUANTIZABLEI32RATIONALI32REALI32REMAINDERI32RUNTIMEREPRI32TRYINTOI32BITSTRINGTRYINTOI32F32STRINGTRYINTOI32I16STRINGTRYINTOI32I8STRINGTRYINTOI32U16STRINGTRYINTOI32U32STRINGTRYINTOI32U64STRINGTRYINTOI32U8STRINGTRYINTOI32UFIXSTRINGTRYINTOI64I32STRINGTRYINTOIFIXI32STRINGTRYINTOINTEGERI32STRINGTRYINTOU32I32STRINGTRYINTOU64I32STRINGTRYINTOUFIXI32STRING
I64 [TYPE] · src
Signed 64-bit integer capable of storing values in [-9223372036854775808, 9223372036854775807]. Uses (signed-byte 64).
Instances
%FILEBYTEI64BITSI64BOUNDEDI64DEFAULTI64EQI64FILEI64HASHI64INTEGRALI64INTOBITI64INTOI16I64INTOI32I64INTOI64CREALINTOI64FRACTIONINTOI64INTEGERINTOI64STRINGINTOI8I64INTOIFIXI64INTOU16I64INTOU32I64INTOU8I64INTOUFIXI64NUMI64ORDI64QUANTIZABLEI64RATIONALI64REALI64REMAINDERI64RUNTIMEREPRI64TRYINTOI64BITSTRINGTRYINTOI64F32STRINGTRYINTOI64F64STRINGTRYINTOI64I16STRINGTRYINTOI64I32STRINGTRYINTOI64I8STRINGTRYINTOI64IFIXSTRINGTRYINTOI64U16STRINGTRYINTOI64U32STRINGTRYINTOI64U64STRINGTRYINTOI64U8STRINGTRYINTOI64UFIXSTRINGTRYINTOINTEGERI64STRINGTRYINTOU64I64STRING
I8 [TYPE] · src
Signed 8-bit integer capable of storing values in [-128, 127]. Uses (signed-byte 8).
Instances
%FILEBYTEI8BITSI8BOUNDEDI8DEFAULTI8EQI8FILEI8HASHI8INTEGRALI8INTOBITI8INTOI8CREALINTOI8F32INTOI8F64INTOI8FRACTIONINTOI8I16INTOI8I32INTOI8I64INTOI8IFIXINTOI8INTEGERINTOI8STRINGNUMI8ORDI8QUANTIZABLEI8RATIONALI8REALI8REMAINDERI8RUNTIMEREPRI8TRYINTOI16I8STRINGTRYINTOI32I8STRINGTRYINTOI64I8STRINGTRYINTOI8BITSTRINGTRYINTOI8U16STRINGTRYINTOI8U32STRINGTRYINTOI8U64STRINGTRYINTOI8U8STRINGTRYINTOI8UFIXSTRINGTRYINTOIFIXI8STRINGTRYINTOINTEGERI8STRINGTRYINTOU16I8STRINGTRYINTOU32I8STRINGTRYINTOU64I8STRINGTRYINTOU8I8STRINGTRYINTOUFIXI8STRING
IFIX [TYPE] · src
Non-allocating tagged integer; range is platform-dependent. Does not error on overflow. Uses fixnum.
Instances
%FILEBYTEIFIXBITSIFIXBOUNDEDIFIXDEFAULTIFIXEQIFIXFILEIFIXHASHIFIXINTEGRALIFIXINTOBITIFIXINTOI16IFIXINTOI32IFIXINTOI8IFIXINTOIFIXCREALINTOIFIXFRACTIONINTOIFIXI64INTOIFIXINTEGERINTOIFIXSTRINGINTOU16IFIXINTOU32IFIXINTOU8IFIXINTOUFIXIFIXNUMIFIXORDIFIXQUANTIZABLEIFIXRATIONALIFIXREALIFIXREMAINDERIFIXRUNTIMEREPRIFIXTRYINTOI64IFIXSTRINGTRYINTOIFIXBITSTRINGTRYINTOIFIXF32STRINGTRYINTOIFIXF64STRINGTRYINTOIFIXI16STRINGTRYINTOIFIXI32STRINGTRYINTOIFIXI8STRINGTRYINTOIFIXU16STRINGTRYINTOIFIXU32STRINGTRYINTOIFIXU64STRINGTRYINTOIFIXU8STRINGTRYINTOIFIXUFIXSTRINGTRYINTOINTEGERIFIXSTRINGTRYINTOU64IFIXSTRING
INTEGER [TYPE]
Integer of unbounded size. Represented by a Common Lisp cl:integer.
Instances
BITSINTEGERCOMPLEXCOMPONENTINTEGERDEFAULTINTEGERDIVIDABLEINTEGERBIG-FLOATDIVIDABLEINTEGERCREALDIVIDABLEINTEGERF32DIVIDABLEINTEGERF64DIVIDABLEINTEGERFRACTIONEQINTEGERHASHINTEGERINTEGRALINTEGERINTOBITINTEGERINTOI16INTEGERINTOI32INTEGERINTOI64INTEGERINTOI8INTEGERINTOIFIXINTEGERINTOINTEGERBIG-FLOATINTOINTEGERCREALINTOINTEGERDYADICINTOINTEGERFRACTIONINTOINTEGERSTRINGINTOU16INTEGERINTOU32INTEGERINTOU64INTEGERINTOU8INTEGERINTOUFIXINTEGERNUMINTEGERORDINTEGERQUANTIZABLEINTEGERRATIONALINTEGERREALINTEGERREMAINDERINTEGERRUNTIMEREPRINTEGERTRYINTOINTEGERBITSTRINGTRYINTOINTEGERF32STRINGTRYINTOINTEGERF64STRINGTRYINTOINTEGERI16STRINGTRYINTOINTEGERI32STRINGTRYINTOINTEGERI64STRINGTRYINTOINTEGERI8STRINGTRYINTOINTEGERIFIXSTRINGTRYINTOINTEGERU16STRINGTRYINTOINTEGERU32STRINGTRYINTOINTEGERU64STRINGTRYINTOINTEGERU8STRINGTRYINTOINTEGERUFIXSTRINGTRYINTOSTRINGINTEGERSTRING
LIST [TYPE]
NILNilrepresents an emptyList.
(CONS :A (LIST:A))Consrepresents aListcontaining a first element (car) and a nestedCons(cdr).
Homogeneous list of objects. Represented as a typical Common Lisp chain of cl:cons (or cl:nil).
Instances
ALTERNATIVELISTAPPLICATIVELISTDEFAULT (LIST:A)EQ :A ⇒ EQ (LIST:A)FOLDABLELISTFROMITERATOR (LIST:A) :AFUNCTORLISTHASH :A ⇒ HASH (LIST:A)INTO (LISPARRAY:A) (LIST:A)INTO (LIST:A) (VECTOR:A)INTO (LISTCHAR)STRINGINTO (OPTIONAL:A) (LIST:A)INTO (SEQ:A) (LIST:A)INTO (VECTOR:A) (LIST:A)INTOSTRING(LISTCHAR)INTOITERATOR (LIST:A) :AISO (LISTCHAR)STRINGISO (VECTOR:A) (LIST:A)MONADLISTMONOID (LIST:A)ORD :A ⇒ ORD (LIST:A)RUNTIMEREPR (LIST:A)RUNTIMEREPR :A ⇒ INTO (LIST:A) (LISPARRAY:A)RUNTIMEREPR :A ⇒ ISO (LISPARRAY:A) (LIST:A)SEMIGROUP (LIST:A)TRAVERSABLELIST
OPTIONAL [TYPE]
(SOME :A)Someexpresses the presence of a meaningful value.
NONENoneexpresses the absence of a meaningful value.
A type that allows indicating the presence or absence of a value. The underlying representation does not allocate when a value is present (i.e., with Some).
Instances
ALTERNATIVEOPTIONALAPPLICATIVEOPTIONALDEFAULT (OPTIONAL:A)EQ :A ⇒ EQ (OPTIONAL:A)FROMITERATOR :A :B ⇒ FROMITERATOR (OPTIONAL:A) (OPTIONAL:B)FUNCTOROPTIONALINTO (OPTIONAL:A) (LIST:A)INTO (OPTIONAL:A) (RESULTUNIT:A)INTO (RESULT:A :B) (OPTIONAL:B)INTOITERATOR (OPTIONAL:A) :AISO (RESULTUNIT:A) (OPTIONAL:A)MONADOPTIONALMONADFAILOPTIONALMONOID :A ⇒ MONOID (OPTIONAL:A)ORD :A ⇒ ORD (OPTIONAL:A)RUNTIMEREPR (OPTIONAL:A)SEMIGROUP :A ⇒ SEMIGROUP (OPTIONAL:A)TRAVERSABLEOPTIONALUNWRAPPABLEOPTIONAL
SINGLE-FLOAT [TYPE] · src
Deprecated name for F32. This is provided for backward compatibility.
STRING [TYPE]
String of characters. Represented by Common Lisp cl:string.
Instances
DEFAULTSTRINGEQSTRINGFROMITERATORSTRINGCHARHASHSTRINGINTO (LISTCHAR)STRINGINTO (VECTORCHAR)STRINGINTO :ASTRING⇒ INTO (CELL:A)STRINGINTOCHARSTRINGINTOF32STRINGINTOF64STRINGINTOFRACTIONSTRINGINTOI16STRINGINTOI32STRINGINTOI64STRINGINTOI8STRINGINTOIFIXSTRINGINTOINTEGERSTRINGINTOPATHNAMESTRINGINTOSTRING(LISTCHAR)INTOSTRING(VECTORCHAR)INTOSTRINGPATHNAMEINTOU16STRINGINTOU32STRINGINTOU64STRINGINTOU8STRINGINTOUFIXSTRINGINTOITERATORSTRINGCHARISO (LISTCHAR)STRINGMONOIDSTRINGORDSTRINGRUNTIMEREPRSTRINGSEMIGROUPSTRINGSIGNALABLESTRINGTRYINTOF32FRACTIONSTRINGTRYINTOF64FRACTIONSTRINGTRYINTOI16BITSTRINGTRYINTOI16I8STRINGTRYINTOI16U16STRINGTRYINTOI16U32STRINGTRYINTOI16U64STRINGTRYINTOI16U8STRINGTRYINTOI16UFIXSTRINGTRYINTOI32BITSTRINGTRYINTOI32F32STRINGTRYINTOI32I16STRINGTRYINTOI32I8STRINGTRYINTOI32U16STRINGTRYINTOI32U32STRINGTRYINTOI32U64STRINGTRYINTOI32U8STRINGTRYINTOI32UFIXSTRINGTRYINTOI64BITSTRINGTRYINTOI64F32STRINGTRYINTOI64F64STRINGTRYINTOI64I16STRINGTRYINTOI64I32STRINGTRYINTOI64I8STRINGTRYINTOI64IFIXSTRINGTRYINTOI64U16STRINGTRYINTOI64U32STRINGTRYINTOI64U64STRINGTRYINTOI64U8STRINGTRYINTOI64UFIXSTRINGTRYINTOI8BITSTRINGTRYINTOI8U16STRINGTRYINTOI8U32STRINGTRYINTOI8U64STRINGTRYINTOI8U8STRINGTRYINTOI8UFIXSTRINGTRYINTOIFIXBITSTRINGTRYINTOIFIXF32STRINGTRYINTOIFIXF64STRINGTRYINTOIFIXI16STRINGTRYINTOIFIXI32STRINGTRYINTOIFIXI8STRINGTRYINTOIFIXU16STRINGTRYINTOIFIXU32STRINGTRYINTOIFIXU64STRINGTRYINTOIFIXU8STRINGTRYINTOIFIXUFIXSTRINGTRYINTOINTEGERBITSTRINGTRYINTOINTEGERF32STRINGTRYINTOINTEGERF64STRINGTRYINTOINTEGERI16STRINGTRYINTOINTEGERI32STRINGTRYINTOINTEGERI64STRINGTRYINTOINTEGERI8STRINGTRYINTOINTEGERIFIXSTRINGTRYINTOINTEGERU16STRINGTRYINTOINTEGERU32STRINGTRYINTOINTEGERU64STRINGTRYINTOINTEGERU8STRINGTRYINTOINTEGERUFIXSTRINGTRYINTOSTRINGINTEGERSTRINGTRYINTOU16BITSTRINGTRYINTOU16I16STRINGTRYINTOU16I8STRINGTRYINTOU16U8STRINGTRYINTOU32BITSTRINGTRYINTOU32F32STRINGTRYINTOU32I16STRINGTRYINTOU32I32STRINGTRYINTOU32I8STRINGTRYINTOU32U16STRINGTRYINTOU32U8STRINGTRYINTOU64BITSTRINGTRYINTOU64F32STRINGTRYINTOU64F64STRINGTRYINTOU64I16STRINGTRYINTOU64I32STRINGTRYINTOU64I64STRINGTRYINTOU64I8STRINGTRYINTOU64IFIXSTRINGTRYINTOU64U16STRINGTRYINTOU64U32STRINGTRYINTOU64U8STRINGTRYINTOU64UFIXSTRINGTRYINTOU8BITSTRINGTRYINTOU8I8STRINGTRYINTOUFIXBITSTRINGTRYINTOUFIXF32STRINGTRYINTOUFIXF64STRINGTRYINTOUFIXI16STRINGTRYINTOUFIXI32STRINGTRYINTOUFIXI8STRINGTRYINTOUFIXU16STRINGTRYINTOUFIXU32STRINGTRYINTOUFIXU8STRING
U16 [TYPE] · src
Unsigned 16-bit integer capable of storing values in [0, 65535]. Uses (unsigned-byte 16).
Instances
%FILEBYTEU16BITSU16BOUNDEDU16DEFAULTU16EQU16FILEU16HASHU16INTEGRALU16INTOBITU16INTOU16CREALINTOU16F32INTOU16F64INTOU16FRACTIONINTOU16I32INTOU16I64INTOU16IFIXINTOU16INTEGERINTOU16STRINGINTOU16U32INTOU16U64INTOU16UFIXINTOU8U16NUMU16ORDU16REMAINDERU16REVERSEBITSU16RUNTIMEREPRU16TRYINTOI16U16STRINGTRYINTOI32U16STRINGTRYINTOI64U16STRINGTRYINTOI8U16STRINGTRYINTOIFIXU16STRINGTRYINTOINTEGERU16STRINGTRYINTOU16BITSTRINGTRYINTOU16I16STRINGTRYINTOU16I8STRINGTRYINTOU16U8STRINGTRYINTOU32U16STRINGTRYINTOU64U16STRINGTRYINTOUFIXU16STRING
U32 [TYPE] · src
Unsigned 32-bit integer capable of storing values in [0, 4294967295]. Uses (unsigned-byte 32).
Instances
%FILEBYTEU32BITSU32BOUNDEDU32DEFAULTU32EQU32FILEU32HASHU32INTEGRALU32INTOBITU32INTOU16U32INTOU32CREALINTOU32F64INTOU32FRACTIONINTOU32I64INTOU32IFIXINTOU32INTEGERINTOU32STRINGINTOU32U64INTOU32UFIXINTOU8U32NUMU32ORDU32QUANTIZABLEU32RATIONALU32REALU32REMAINDERU32REVERSEBITSU32RUNTIMEREPRU32TRYINTOI16U32STRINGTRYINTOI32U32STRINGTRYINTOI64U32STRINGTRYINTOI8U32STRINGTRYINTOIFIXU32STRINGTRYINTOINTEGERU32STRINGTRYINTOU32BITSTRINGTRYINTOU32F32STRINGTRYINTOU32I16STRINGTRYINTOU32I32STRINGTRYINTOU32I8STRINGTRYINTOU32U16STRINGTRYINTOU32U8STRINGTRYINTOU64U32STRINGTRYINTOUFIXU32STRING
U64 [TYPE] · src
Unsigned 64-bit integer capable of storing values in [0, 18446744073709551615]. Uses (unsigned-byte 64).
Instances
%FILEBYTEU64BITSU64BOUNDEDU64DEFAULTU64EQU64FILEU64HASHU64INTEGRALU64INTOBITU64INTOU16U64INTOU32U64INTOU64CREALINTOU64FRACTIONINTOU64INTEGERINTOU64STRINGINTOU8U64INTOUFIXU64NUMU64ORDU64QUANTIZABLEU64RATIONALU64REALU64REMAINDERU64REVERSEBITSU64RUNTIMEREPRU64TRYINTOI16U64STRINGTRYINTOI32U64STRINGTRYINTOI64U64STRINGTRYINTOI8U64STRINGTRYINTOIFIXU64STRINGTRYINTOINTEGERU64STRINGTRYINTOU64BITSTRINGTRYINTOU64F32STRINGTRYINTOU64F64STRINGTRYINTOU64I16STRINGTRYINTOU64I32STRINGTRYINTOU64I64STRINGTRYINTOU64I8STRINGTRYINTOU64IFIXSTRINGTRYINTOU64U16STRINGTRYINTOU64U32STRINGTRYINTOU64U8STRINGTRYINTOU64UFIXSTRING
U8 [TYPE] · src
Unsigned 8-bit integer capable of storing values in [0, 255]. Uses (unsigned-byte 8).
Instances
%FILEBYTEU8BITSU8BOUNDEDU8DEFAULTU8EQU8FILEU8HASHU8INTEGRALU8INTOBITU8INTOU8CREALINTOU8F32INTOU8F64INTOU8FRACTIONINTOU8I16INTOU8I32INTOU8I64INTOU8IFIXINTOU8INTEGERINTOU8STRINGINTOU8U16INTOU8U32INTOU8U64INTOU8UFIXNUMU8ORDU8QUANTIZABLEU8RATIONALU8REALU8REMAINDERU8REVERSEBITSU8RUNTIMEREPRU8TRYINTOI16U8STRINGTRYINTOI32U8STRINGTRYINTOI64U8STRINGTRYINTOI8U8STRINGTRYINTOIFIXU8STRINGTRYINTOINTEGERU8STRINGTRYINTOU16U8STRINGTRYINTOU32U8STRINGTRYINTOU64U8STRINGTRYINTOU8BITSTRINGTRYINTOU8I8STRINGTRYINTOUFIXU8STRING
UFIX [TYPE] · src
Non-allocating tagged non-negative integer; range is platform-dependent. Uses (and fixnum unsigned-byte).
Instances
%FILEBYTEUFIXBITSUFIXBOUNDEDUFIXDEFAULTUFIXEQUFIXFILEUFIXHASHUFIXINTEGRALUFIXINTOBITUFIXINTOU16UFIXINTOU32UFIXINTOU8UFIXINTOUFIXCREALINTOUFIXFRACTIONINTOUFIXI64INTOUFIXIFIXINTOUFIXINTEGERINTOUFIXSTRINGINTOUFIXU64NUMUFIXORDUFIXQUANTIZABLEUFIXRATIONALUFIXREALUFIXREMAINDERUFIXREVERSEBITSUFIXRUNTIMEREPRUFIXTRYINTOI16UFIXSTRINGTRYINTOI32UFIXSTRINGTRYINTOI64UFIXSTRINGTRYINTOI8UFIXSTRINGTRYINTOIFIXUFIXSTRINGTRYINTOINTEGERUFIXSTRINGTRYINTOU64UFIXSTRINGTRYINTOUFIXBITSTRINGTRYINTOUFIXF32STRINGTRYINTOUFIXF64STRINGTRYINTOUFIXI16STRINGTRYINTOUFIXI32STRINGTRYINTOUFIXI8STRINGTRYINTOUFIXU16STRINGTRYINTOUFIXU32STRINGTRYINTOUFIXU8STRING
UNIT [TYPE]
UNITUnitrepresents nullary parameters and return types.
The “unit” type whose only member is the value Unit.
VOID [TYPE] · src
Instances
Values
(CONS X XS) [FUNCTION] · src
∀ :A. (:A → (LIST :A) → (LIST :A))
(INLINE APPLICATION) [FUNCTION] · src
∀ :A. (:A → :A)
Try to inline application. It will only attempt to inline
application written syntactically as a function application.
(LIKELY PREDICATE) [FUNCTION] · src
Hint to the compiler that predicate is likely True.
(NOINLINE APPLICATION) [FUNCTION] · src
∀ :A. (:A → :A)
Prevent application from being inlined. It will prevent
inlining when the argument is syntactically a function application.
(SOME X) [FUNCTION] · src
∀ :A. (:A → (OPTIONAL :A))
A constructor for the type, Optional. This constructor can be used
like any other algebraic data type constructor, including for pattern
matching, as in the following example.
(match x
((Some value)
value)
(_ (error "Oh, no!")))
(UNLIKELY PREDICATE) [FUNCTION] · src
Hint to the compiler that predicate is likely False.
FALSE [VALUE] · src
NIL [VALUE] · src
∀ :A. (LIST :A)
NONE [VALUE] · src
∀ :A. (OPTIONAL :A)
A constructor for the type, Optional. This constructor can be used
like any other algebraic data type constructor, including for pattern
matching, as in the following example.
(match x
((None)
"Fantastic!")
(_ (error "Oh, no!")))
TRUE [VALUE] · src
UNIT [VALUE] · src
Macros
.< (&REST ITEMS) [MACRO]
Right associative compose operator. Creates a new functions that will run the
functions right to left when applied. This is the same as the nest macro without supplying
the value. The composition is thus the same order as compose.
(.< f g h) creates the function (fn (x) (f (g (h x)))).
.> (&REST ITEMS) [MACRO]
Left associative compose operator. Creates a new functions that will run the
functions left to right when applied. This is the same as the pipe macro without supplying
the value. The composition is thus the reverse order of compose.
(.> f g h) creates the function (fn (x) (h (g (f x)))).
AS (TYPE &OPTIONAL (EXPR NIL EXPR-SUPPLIED-P)) [MACRO]
A syntactic convenience for type casting.
(as <type> <expr>)
is equivalent to
(the <type> (into <expr>))
and
(as <type>)
is equivalent to
(fn (expr) (the <type> (into expr))).
Note that this may copy the object or allocate memory.
ASSERT (DATUM &OPTIONAL (FORMAT-STRING "") &REST FORMAT-DATA) [MACRO]
Signal an error unless datum is True.
If the assertion fails, the signaled error will apply the format-data
to the format-string via cl:format to produce an error message.
MAKE-LIST (&REST FORMS) [MACRO]
Create a heterogeneous Coalton List of objects. This macro is
deprecated; use coalton-library/list:make.
NEST (&REST ITEMS) [MACRO]
A syntactic convenience for function application. Transform
(nest f g h x)
to
(f (g (h x))).
PIPE (&REST ITEMS) [MACRO]
A syntactic convenience for function application, sometimes called a “threading macro”. Transform
(pipe x h g f)
to
(f (g (h x))).
TRY-AS (TYPE &OPTIONAL (EXPR NIL EXPR-SUPPLIED-P)) [MACRO]
A syntactic convenience for type casting.
(try-as <type> <expr>)
is equivalent to
(the (Result :_ <type>) (tryInto <expr>))
and
(try-as <type>)
is equivalent to
(fn (expr) (the (Result :_ <type>) (tryInto expr))).
Note that this may copy the object or allocate memory.
UNWRAP-AS (TYPE &OPTIONAL (EXPR NIL EXPR-SUPPLIED-P)) [MACRO]
A syntactic convenience for type casting.
(unwrap-as <type> <expr>)
is equivalent to
(the <type> (uwrap (tryInto <expr>)))
and
(unwrap-as <type>)
is equivalent to
(fn (expr) (the <type> (unwrap (tryInto expr)))).
Note that this may copy the object or allocate memory.
Package COALTON-LIBRARY/ALGORITHMS/FFT
A coalton package for performing FFTs.
Classes
FFTCYCLICGROUP [CLASS] · src
A class of types, each of which is a mathematical cyclic group.
These are types which are valid elements for a collection which may undergo a discrete Fourier transform. Examples include complex floating-point numbers and finite (modular) integers.
Methods:
CYCLIC-ADD-IDENTITY :: :ACYCLIC-ADD :: (:A → :A → :A)CYCLIC-ADD-INVERSE :: (:A → :A)CYCLIC-NTH-GENERATOR :: (UFIX→ :A)
A function which returns a primitiventh root of unity.
Instances
FFTFIELD [CLASS] · src
A class of types, each of which is a mathematical field.
These are types which are valid elements for a collection which may undergo a discrete Fourier transform. Examples include complex floating-point numbers and finite (modular) integers.
Methods:
MULTIPLY-INVERSE :: (:A → :A)
FFTGROUP [CLASS] · src
FFTGROUP :A
A class of types, each of which is a mathematical group.
These are types which are valid elements for a collection which may undergo a discrete Fourier transform. Examples include complex floating-point numbers and finite (modular) integers.
Methods:
ADD-IDENTITY :: :AADD :: (:A → :A → :A)ADD-INVERSE :: (:A → :A)
FFTRING [CLASS] · src
A class of types, each of which is a mathematical ring.
These are types which are valid elements for a collection which may undergo a discrete Fourier transform. Examples include complex floating-point numbers and finite (modular) integers.
Methods:
MULTIPLY-IDENTITY :: :AMULTIPLY :: (:A → :A → :A)
Values
(DIF-FFT-RAW DST SRC) [FUNCTION] · src
∀ :A :B :C. (RANDOMACCESS :B :A) (RANDOMACCESS :C :A) (FFTRING :A) (FFTCYCLICGROUP :A) ⇒ (:B → :C → UNIT)
A decimation-in-frequency fast fourier transform, reading from src and writing to dst.
Input: natural order Output: bit-reversed order Normalization: none
(DIF-IFFT-RAW DST SRC) [FUNCTION] · src
∀ :A :B :C. (RANDOMACCESS :B :A) (RANDOMACCESS :C :A) (FFTRING :A) (FFTCYCLICGROUP :A) ⇒ (:B → :C → UNIT)
A decimation-in-frequency inverse fast fourier transform, reading from src and writing to dst.
Input: natural order Output: bit-reversed order Normalization: none
(DIT-FFT-RAW DST SRC) [FUNCTION] · src
∀ :A :B :C. (RANDOMACCESS :B :A) (RANDOMACCESS :C :A) (FFTRING :A) (FFTCYCLICGROUP :A) ⇒ (:B → :C → UNIT)
A decimation-in-time fast fourier transform, reading from src and writing to dst.
Input: bit-reversed order Output: natural order Normalization: none
(DIT-IFFT-RAW DST SRC) [FUNCTION] · src
∀ :A :B :C. (RANDOMACCESS :B :A) (RANDOMACCESS :C :A) (FFTRING :A) (FFTCYCLICGROUP :A) ⇒ (:B → :C → UNIT)
A decimation-in-time inverse fast fourier transform, reading from src and writing to dst.
Input: bit-reversed order Output: natural order Normalization: none
(DIVIDE X Y) [FUNCTION] · src
∀ :A. FFTFIELD :A ⇒ (:A → :A → :A)
(FFT STORAGE) [FUNCTION] · src
∀ :A :B :C. (RANDOMACCESS :B :A) (RANDOMACCESS :C :A) (FFTRING :A) (FFTCYCLICGROUP :A) ⇒ (:B → :C)
Perform a fast Fourier transform on the data in storage.
(FFT! STORAGE) [FUNCTION] · src
∀ :A :B. (RANDOMACCESS :B :A) (FFTRING :A) (FFTCYCLICGROUP :A) ⇒ (:B → :B)
Perform an in-place fast Fourier transform on storage.
(FFT-INTO! DST SRC) [FUNCTION] · src
∀ :A :B :C. (RANDOMACCESS :C :A) (RANDOMACCESS :B :A) (FFTRING :A) (FFTCYCLICGROUP :A) ⇒ (:B → :C → :B)
Perform a fast Fourier transform of src, writing the result to dst. If dst is longer than src, then remaining elements of dst are left unmutated.
(IFFT STORAGE) [FUNCTION] · src
∀ :A :B :C. (RANDOMACCESS :B :A) (RANDOMACCESS :C :A) (FFTFIELD :A) (FFTCYCLICGROUP :A) (NUM :A) ⇒ (:B → :C)
Perform an inverse fast Fourier transform on the data in storage.
(IFFT! STORAGE) [FUNCTION] · src
∀ :A :B. (RANDOMACCESS :B :A) (FFTFIELD :A) (FFTCYCLICGROUP :A) (NUM :A) ⇒ (:B → :B)
Perform an in-place inverse fast Fourier transform on storage.
(IFFT-INTO! DST SRC) [FUNCTION] · src
∀ :A :B :C. (RANDOMACCESS :C :A) (RANDOMACCESS :B :A) (FFTFIELD :A) (FFTCYCLICGROUP :A) (NUM :A) ⇒ (:B → :C → :B)
Perform an inverse fast Fourier transform of src, writing the result to dst. If dst is longer than src, then remaining elements of dst are left unmutated.
(SUBTRACT X Y) [FUNCTION] · src
∀ :A. FFTGROUP :A ⇒ (:A → :A → :A)
Package COALTON-LIBRARY/BIG-FLOAT
Types
BIG-FLOAT [TYPE] · src
An arbitrary (but fixed) precision floating point number.
Instances
COMPLEXCOMPONENTBIG-FLOATDIVIDABLEINTEGERBIG-FLOATELEMENTARYBIG-FLOATEQBIG-FLOATEXPONENTIABLEBIG-FLOATINTOF32BIG-FLOATINTOF64BIG-FLOATINTOFRACTIONBIG-FLOATINTOINTEGERBIG-FLOATNUMBIG-FLOATORDBIG-FLOATPOLARBIG-FLOATQUANTIZABLEBIG-FLOATRADICALBIG-FLOATRATIONALBIG-FLOATREALBIG-FLOATRECIPROCABLEBIG-FLOATRUNTIMEREPRBIG-FLOATTRANSFINITEBIG-FLOATTRIGONOMETRICBIG-FLOAT
ROUNDINGMODE [TYPE] · src
Instances
Values
(BF-EE _) [FUNCTION] · src
∀ :A. (:A → BIG-FLOAT)
Return the value of ee = exp(1) to the currently set precision.
(BF-PI _) [FUNCTION] · src
∀ :A. (:A → BIG-FLOAT)
Return the value of pi to the currently set precision.
(GET-PRECISION _) [FUNCTION] · src
Get the current precision of Big-Float arithmetic.
(GET-ROUNDING-MODE _) [FUNCTION] · src
(UNIT → ROUNDINGMODE)
Get the current rounding-mode of Big-Float arithmetic.
(SET-PRECISION! PREC-BITS) [FUNCTION] · src
Set the precision of Big-Float arithmetic to PREC-BITS bits.
(SET-ROUNDING-MODE! R) [FUNCTION] · src
(ROUNDINGMODE → UNIT)
Set the global rounding mode for Big-Float operations.
(WITH-PRECISION PREC-BITS F) [FUNCTION] · src
∀ :A. (UFIX → (UNIT → :A) → :A)
Call F with a temporary Big-Float precision PREC-BITS.
(WITH-PRECISION-ROUNDING PREC-BITS RND F) [FUNCTION] · src
∀ :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] · src
∀ :A. (ROUNDINGMODE → (UNIT → :A) → :A)
Call F with a temporary Big-Float rounding-mode RND.
RNDA [VALUE] · src
RouND Away from zero.
RNDD [VALUE] · src
RouND Down, toward negative infinity.
RNDF [VALUE] · src
Faithful rounding (experimental).
RNDN [VALUE] · src
RouND to Nearest, with the even rounding rule.
RNDNA [VALUE] · src
RouND to Nearest Away.
RNDU [VALUE] · src
RouND Up, toward positive infinity.
RNDZ [VALUE] · src
RouND toward Zero.
Package COALTON-LIBRARY/BITS
Classes
BITS [CLASS] · src
Operations on the bits of twos-complement integers
Methods:
AND :: (:A → :A → :A)
The bitwise logicalandof two integersOR :: (:A → :A → :A)
The bitwise logicalorof two integersXOR :: (:A → :A → :A)
The bitwise logical exclusiveorof two integersNOT :: (:A → :A)
The bitwise logicalnotof two integersSHIFT :: (INTEGER→ :A → :A)
The arithmetic left-shift of an integer by an integer number of bits
Instances
REVERSEBITS [CLASS] · src
REVERSEBITS :A
A type class for number types that support bit reversal.
Methods:
REVERSE-BITS :: (:A → :A)
Reverse the bits ofx.REVERSE-N-BITS :: (UFIX→ :A → :A)
Reverse the firstnbits ofxand set the rest to 0.
Instances
Values
(DPB NEWBYTE SIZE POSITION BITSTRING) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
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] · src
The logical negation of x. Is x false?
(BOOLEAN-OR X Y) [FUNCTION] · src
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] · src
Are x or y true, but not both?
(NOT X) [FUNCTION] · src
Synonym for boolean-not.
(UNDEFINED _) [FUNCTION] · src
∀ :A :B. (:A → :B)
A function which can be used in place of any value, throwing an error at runtime.
(XOR X Y) [FUNCTION] · src
Synonym for boolean-xor.
Macros
UNREACHABLE (&OPTIONAL (DATUM "Unreachable") &REST ARGUMENTS) [MACRO]
Signal an error with CL format string DATUM and optional format arguments ARGUMENTS.
Package COALTON-LIBRARY/CELL
Types
CELL [TYPE] · src
Internally mutable cell
Instances
Values
(DECREMENT! CEL) [FUNCTION] · src
∀ :A. NUM :A ⇒ ((CELL :A) → :A)
Subtract one from the contents of cel, storing and returning the new
value.
(INCREMENT! CEL) [FUNCTION] · src
∀ :A. NUM :A ⇒ ((CELL :A) → :A)
Add one to the contents of cel, storing and returning the new value.
(NEW DATA) [FUNCTION] · src
∀ :A. (:A → (CELL :A))
Create a new mutable cell containing data.
(POP! CEL) [FUNCTION] · src
∀ :A. ((CELL (LIST :A)) → (OPTIONAL :A))
Remove and return the first element of the list in cel.
(PUSH! CEL NEW-ELT) [FUNCTION] · src
∀ :A. ((CELL (LIST :A)) → :A → (LIST :A))
Push new-elt onto the start of the list in cel.
(READ CEL) [FUNCTION] · src
∀ :A. ((CELL :A) → :A)
Read the value of a mutable cell cel.
(SWAP! CEL DATA) [FUNCTION] · src
∀ :A. ((CELL :A) → :A → :A)
Replace the value of a mutable cell cel with a new value data,
then return the old value.
(UPDATE! F CEL) [FUNCTION] · src
∀ :A. ((:A → :A) → (CELL :A) → :A)
Apply f to the contents of cel, storing and returning the result.
(UPDATE-SWAP! F CEL) [FUNCTION] · src
∀ :A. ((:A → :A) → (CELL :A) → :A)
Apply f to the contents of cel, swapping the result for the old
value.
(WRITE! CEL DATA) [FUNCTION] · src
∀ :A. ((CELL :A) → :A → :A)
Set the value of a mutable cell cel to data, returning the new
value.
Package COALTON-LIBRARY/CHAR
Values
(ALPHA? C) [FUNCTION] · src
Is c an alphabetic character?
(ASCII-ALPHA? C) [FUNCTION] · src
Is c an ASCII alphabetic character?
(ASCII-ALPHANUMERIC? C) [FUNCTION] · src
Is c an ASCII alphanumeric character?
(ASCII-DIGIT? C) [FUNCTION] · src
Is c an ASCII digit character?
(ASCII-LOWERCASE? C) [FUNCTION] · src
Is c an ASCII lowercase character?
(ASCII-UPPERCASE? C) [FUNCTION] · src
Is c an ASCII uppercase character?
(CHAR-CODE CHAR) [FUNCTION] · src
Convert a character to its ASCII representation.
(CODE-CHAR CODE) [FUNCTION] · src
Convert a number to its ASCII character, returning None on failure.
(DIGIT? C) [FUNCTION] · src
Is c a digit character?
(DOWNCASE C) [FUNCTION] · src
Returns the downcased version of c, returning c when there is none.
(LOWERCASE? C) [FUNCTION] · src
Is c a lowercase character?
(RANGE START END) [FUNCTION] · src
(CHAR → CHAR → (ITERATOR CHAR))
An inclusive range of characters from start to end by char-code.
(UPCASE C) [FUNCTION] · src
Returns the upcased version of c, returning c when there is none.
(UPPERCASE? C) [FUNCTION] · src
Is c an uppercase character?
Package COALTON-LIBRARY/CLASSES
Types
HASH [TYPE] · src
Implementation dependent hash code.
ORD [TYPE] · src
LT- Less than
GT- Greater than
EQ- Equal to
The result of an ordered comparison.
RESULT [TYPE] · src
(ERR :A)(OK :B)
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)BIFUNCTORRESULTFROMITERATOR :A :B ⇒ FROMITERATOR (RESULT:C :A) (RESULT:C :B)FUNCTOR (RESULT:A)INTO (OPTIONAL:A) (RESULTUNIT:A)INTO (RESULT:A :B) (OPTIONAL:B)INTOITERATOR (RESULT:A :B) :BISO (RESULTUNIT:A) (OPTIONAL:A)MONAD (RESULT:A)MONOID :A ⇒ MONOID (RESULT:B :A)RUNTIMEREPR (RESULT:A :B)SEMIGROUP :A ⇒ SEMIGROUP (RESULT:B :A)TRAVERSABLE (RESULT:A)UNWRAPPABLE (RESULT:A)
Structs
TUPLE :A :B [STRUCT] · src
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)BIFUNCTORTUPLEHASH :A ⇒ FROMITERATOR (HASHMAP:A :B) (TUPLE:A :B)HASH :A ⇒ FROMITERATOR (HASHTABLE:A :B) (TUPLE:A :B)INTO (MAPPAIR:A :B) (TUPLE:A :B)INTO (TUPLE:A :B) (TUPLE:B :A)INTOITERATOR (HASHMAP:A :B) (TUPLE:A :B)INTOITERATOR (HASHTABLE:A :B) (TUPLE:A :B)INTOITERATOR (ORDMAP:A :B) (TUPLE:A :B)ISO (TUPLE:A :B) (TUPLE:B :A)ORD :A ⇒ FROMITERATOR (ORDMAP:A :B) (TUPLE:A :B)RUNTIMEREPR (TUPLE:A :B)
Classes
ALTERNATIVE [CLASS] · src
APPLICATIVE :A ⇒ ALTERNATIVE :A
Types which are monoids on applicative functors.
Methods:
ALT :: ((:A :B) → (:A :B) → (:A :B))EMPTY :: (:A :C)
Instances
MONAD :A ⇒ ALTERNATIVE (OPTIONALT:A)ALTERNATIVELISTALTERNATIVEOPTIONAL
APPLICATIVE [CLASS] · src
FUNCTOR :A ⇒ APPLICATIVE :A
Types which are a functor which can embed pure expressions and sequence operations.
Methods:
PURE :: (:B → (:A :B))LIFTA2 :: ((:C → :D → :E) → (:A :C) → (:A :D) → (:A :E))
Instances
(FUNCTOR :A) (MONAD :B) ⇒ APPLICATIVE ((FREET:A) :B)FUNCTOR :A ⇒ APPLICATIVE (FREE:A)MONAD :A ⇒ APPLICATIVE (OPTIONALT:A)MONAD :A ⇒ APPLICATIVE ((RESULTT:B) :A)APPLICATIVE :A ⇒ APPLICATIVE ((ENVT:B) :A)APPLICATIVE (ENV:A)APPLICATIVE :A ⇒ APPLICATIVE ((STATET:B) :A)APPLICATIVE (ST:A)APPLICATIVEIDENTITYAPPLICATIVELISTAPPLICATIVE (RESULT:A)APPLICATIVEOPTIONALAPPLICATIVECELLAPPLICATIVE (ARROW:A)
BIFUNCTOR [CLASS] · src
BIFUNCTOR :A
Types which take two type arguments and are functors on both.
Methods:
BIMAP :: ((:B → :C) → (:D → :E) → ((:A :B) :D) → ((:A :C) :E))
DEFAULT [CLASS] · src
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)DEFAULTSTRINGDEFAULT (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)DEFAULTF64DEFAULTF32DEFAULTINTEGERDEFAULTUFIXDEFAULTIFIXDEFAULTU64DEFAULTU32DEFAULTU16DEFAULTI64DEFAULTI32DEFAULTI16DEFAULTU8DEFAULTI8DEFAULTBITDEFAULTSYMBOLDEFAULTBOOLEANDEFAULTHASH
EQ [CLASS] · src
EQ :A
Types which have equality defined.
Methods:
== :: (:A → :A →BOOLEAN)
Instances
EQCREALEQBIG-FLOATEQPATHNAMEEQ :A ⇒ EQ (SEQ:A)(EQ :A) (EQ :B) ⇒ EQ (ORDMAP:A :B)EQ :A ⇒ EQ (MAPPAIR:A :B)EQCOLOREQ :A ⇒ EQ (TREE:A)EQ :A ⇒ EQ (QUEUE:A)(EQ :A) (EQ :B) ⇒ EQ (HASHMAP:A :B)(HASH :A) (EQ :B) ⇒ EQ (HASHTABLE:A :B)EQ :A ⇒ EQ (SLICE:A)EQSTRINGEQCHAREQ :A ⇒ EQ (VECTOR:A)EQ :A ⇒ EQ (LIST:A)EQ :A ⇒ EQ (LISPARRAY: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 (HYPERDUAL:A)EQ :A ⇒ EQ (DUAL:A)
Note: Eq only compares the primal component.EQDYADICCOMPLEXCOMPONENT :A ⇒ EQ (COMPLEX:A)EQFRACTIONEQF64EQF32EQU64EQI64EQU32EQI32EQU16EQI16EQU8EQI8EQBITEQUFIXEQIFIXEQINTEGEREQSYMBOLEQBOOLEANEQHASHEQORDEQUNITEQLISPTYPE
FOLDABLE [CLASS] · src
FOLDABLE :A
Types which can be folded into a single element.
Methods:
FOLD :: ((:B → :C → :B) → :B → (:A :C) → :B)
A left tail-recursive fold.FOLDR :: ((:D → :E → :E) → :E → (:A :D) → :E)
A right non-tail-recursive fold.
Instances
FUNCTOR [CLASS] · src
FUNCTOR :A
Types which can map an inner type where the mapping adheres to the identity and composition laws.
Methods:
MAP :: ((:B → :C) → (:A :B) → (:A :C))
Instances
FUNCTORSEQFUNCTOR (ORDMAP:A)(FUNCTOR :A) (FUNCTOR :B) ⇒ FUNCTOR ((FREET:A) :B)FUNCTOR :A ⇒ FUNCTOR ((FREEF:A) :B)FUNCTOR :A ⇒ FUNCTOR (FREE:A)FUNCTOR :A ⇒ FUNCTOR (OPTIONALT:A)FUNCTOR :A ⇒ FUNCTOR ((RESULTT:B) :A)FUNCTOR :A ⇒ FUNCTOR ((ENVT:B) :A)FUNCTOR (ENV:A)FUNCTOR :A ⇒ FUNCTOR ((STATET:B) :A)FUNCTOR (ST:A)FUNCTORIDENTITYFUNCTORQUEUEFUNCTORVECTORFUNCTORLISTFUNCTOR (RESULT:A)FUNCTOROPTIONALFUNCTORITERATORFUNCTORCELLFUNCTOR (ARROW:A)
HASH [CLASS] · src
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 (ORDMAP:A :B)HASH :A ⇒ HASH (TREE:A)(HASH :A) (HASH :B) ⇒ HASH (HASHMAP:A :B)(HASH :A) (HASH :B) ⇒ HASH (HASHTABLE:A :B)HASHSTRINGHASHCHARHASH :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 (HYPERDUAL:A)HASH :A ⇒ HASH (DUAL:A)
Note: Hash only considers the primal component in order to be consistent with Eq.HASHF64HASHF32HASHUFIXHASHIFIXHASHU64HASHU32HASHU16HASHU8HASHBITHASHI64HASHI32HASHI16HASHI8HASHINTEGERHASHBOOLEANHASHHASH
INTO [CLASS] · src
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
INTOI8CREALINTOU8CREALINTOI16CREALINTOU16CREALINTOI32CREALINTOU32CREALINTOI64CREALINTOU64CREALINTOIFIXCREALINTOUFIXCREALINTOINTEGERCREALINTOFRACTIONCREALINTOF64CREALINTOF32CREAL(COMPLEXCOMPONENT :A) (INTO :ACREAL) ⇒ INTO (COMPLEX:A) (COMPLEXCREAL)INTOF64BIG-FLOATINTOF32BIG-FLOATINTOFRACTIONBIG-FLOATINTOINTEGERBIG-FLOATINTOPATHNAMESTRINGINTOSTRINGPATHNAMEINTO (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)INTOF64STRINGINTOF32STRINGINTOFRACTIONSTRINGINTOU64STRINGINTOI64STRINGINTOU32STRINGINTOI32STRINGINTOU16STRINGINTOI16STRINGINTOU8STRINGINTOI8STRINGINTOUFIXSTRINGINTOIFIXSTRINGINTOINTEGERSTRINGINTO (VECTORCHAR)STRINGINTO (LISTCHAR)STRINGINTOCHARSTRINGINTOSTRING(VECTORCHAR)INTOSTRING(LISTCHAR)INTO (VECTOR:A) (LIST:A)INTO (LIST:A) (VECTOR:A)INTO (OPTIONAL:A) (LIST:A)INTO (LISPARRAY:A) (LIST:A)RUNTIMEREPR :A ⇒ INTO (LIST:A) (LISPARRAY:A)INTO (OPTIONAL:A) (RESULTUNIT:A)INTO (RESULT:A :B) (OPTIONAL:B)INTO (TUPLE:A :B) (TUPLE:B :A)INTO :ASTRING⇒ INTO (CELL:A)STRINGINTO (CELL:A) :AINTO :A (CELL:A)(COMPLEXCOMPONENT :A) (INTO :A (HYPERDUAL:A)) ⇒ INTO (COMPLEX:A) (COMPLEX(HYPERDUAL:A))NUM :A ⇒ INTO :A (HYPERDUAL:A)INTOINTEGERDYADICINTODYADICFRACTIONCOMPLEXCOMPONENT :A ⇒ INTO :A (COMPLEX:A)INTOUFIXFRACTIONINTOU64FRACTIONINTOU32FRACTIONINTOU16FRACTIONINTOU8FRACTIONINTOBITFRACTIONINTOIFIXFRACTIONINTOI64FRACTIONINTOI32FRACTIONINTOI16FRACTIONINTOI8FRACTIONINTOINTEGERFRACTIONINTOI32F64INTOU32F64INTOI16F64INTOU16F64INTOI8F64INTOU8F64INTOBITF64INTOI16F32INTOU16F32INTOI8F32INTOU8F32INTOBITF32INTOIFIXINTEGERINTOIFIXI64INTOUFIXINTEGERINTOUFIXIFIXINTOUFIXI64INTOUFIXU64INTOI64INTEGERINTOU64INTEGERINTOI32INTEGERINTOI32IFIXINTOI32I64INTOU32INTEGERINTOU32IFIXINTOU32UFIXINTOU32I64INTOU32U64INTOI16INTEGERINTOI16IFIXINTOI16I64INTOI16I32INTOU16INTEGERINTOU16IFIXINTOU16UFIXINTOU16I64INTOU16U64INTOU16I32INTOU16U32INTOI8INTEGERINTOI8IFIXINTOI8I64INTOI8I32INTOI8I16INTOU8INTEGERINTOU8IFIXINTOU8UFIXINTOU8I64INTOU8U64INTOU8I32INTOU8U32INTOU8I16INTOU8U16INTOBITINTEGERINTOBITIFIXINTOBITUFIXINTOBITI64INTOBITU64INTOBITI32INTOBITU32INTOBITI16INTOBITU16INTOBITI8INTOBITU8INTO :A :A
ISO [CLASS] · src
(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] · src
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))
Instances
(FUNCTOR :A) (MONAD :B) ⇒ MONAD ((FREET:A) :B)FUNCTOR :A ⇒ MONAD (FREE:A)MONAD :A ⇒ MONAD (OPTIONALT:A)MONAD :A ⇒ MONAD ((RESULTT:B) :A)MONAD :A ⇒ MONAD ((ENVT:B) :A)MONAD (ENV:A)MONAD :A ⇒ MONAD ((STATET:B) :A)MONAD (ST:A)MONADIDENTITYMONADLISTMONAD (RESULT:A)MONADOPTIONALMONAD (ARROW:A)
MONADFAIL [CLASS] · src
Methods:
FAIL :: (STRING→ (:A :B))
MONADTRANSFORMER [CLASS] · src
Types which are monads that wrap another monad, allowing you to use - for example - State and Result together.
Methods:
LIFT :: MONAD :B ⇒ ((:B :C) → ((:A :B) :C))
Instances
FUNCTOR :A ⇒ MONADTRANSFORMER (FREET:A)MONADTRANSFORMEROPTIONALTMONADTRANSFORMER (RESULTT:A)MONADTRANSFORMER (ENVT:A)MONADTRANSFORMER (STATET:A)
MONOID [CLASS] · src
Types with an associative binary operation and identity defined.
Methods:
MEMPTY :: :A
Instances
NUM [CLASS] · src
Types which have numeric operations defined.
Methods:
+ :: (:A → :A → :A)- :: (:A → :A → :A)* :: (:A → :A → :A)FROMINT :: (INTEGER→ :A)
Instances
ORD [CLASS] · src
Types whose values can be ordered. Requires Eq.
Methods:
<=> :: (:A → :A →ORD)
Given two objects, return their comparison (as anOrdobject).
Instances
ORDCREALORDBIG-FLOATORDPATHNAMEORD :A ⇒ ORD (MAPPAIR:A :B)ORDSTRINGORDCHARORD :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 (HYPERDUAL:A)ORD :A ⇒ ORD (DUAL:A)
Note: Ord only compares the primal component.ORDDYADICORDFRACTIONORDF64ORDF32ORDU64ORDI64ORDU32ORDI32ORDU16ORDI16ORDU8ORDI8ORDBITORDUFIXORDIFIXORDINTEGERORDBOOLEANORDHASHORDORD
SEMIGROUP [CLASS] · src
SEMIGROUP :A
Types with an associative binary operation defined.
Methods:
<> :: (:A → :A → :A)
Instances
SEMIGROUPPATHNAMERUNTIMEREPR :A ⇒ SEMIGROUP (SEQ:A)ORD :A ⇒ SEMIGROUP (ORDMAP:A :B)ORD :A ⇒ SEMIGROUP (TREE:A)SEMIGROUP (QUEUE:A)SEMIGROUPSTRINGSEMIGROUP (VECTOR:A)SEMIGROUP (LIST:A)SEMIGROUP :A ⇒ SEMIGROUP (RESULT:B :A)SEMIGROUP :A ⇒ SEMIGROUP (OPTIONAL:A)SEMIGROUP :A ⇒ SEMIGROUP (CELL:A)SEMIGROUPHASH
SIGNALABLE [CLASS] · src
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] · src
TRAVERSABLE :A
Methods:
TRAVERSE :: APPLICATIVE :B ⇒ ((:C → (:B :D)) → (:A :C) → (:B (:A :D)))
Instances
(MONAD :A) (TRAVERSABLE :A) (TRAVERSABLE :B) ⇒ TRAVERSABLE ((FREET:B) :A)TRAVERSABLE :A ⇒ TRAVERSABLE ((FREEF:A) :B)TRAVERSABLE :A ⇒ TRAVERSABLE (FREE:A)TRAVERSABLELISTTRAVERSABLE (RESULT:A)TRAVERSABLEOPTIONAL
TRYINTO [CLASS] · src
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:C :B))
Instances
TRYINTOSTRINGINTEGERSTRINGTRYINTOUFIXF64STRINGTRYINTOIFIXF64STRINGTRYINTOU64F64STRINGTRYINTOI64F64STRINGTRYINTOI32F32STRINGTRYINTOU32F32STRINGTRYINTOUFIXF32STRINGTRYINTOIFIXF32STRINGTRYINTOU64F32STRINGTRYINTOI64F32STRINGTRYINTOINTEGERF64STRINGTRYINTOINTEGERF32STRINGTRYINTOINTEGERIFIXSTRINGTRYINTOINTEGERUFIXSTRINGTRYINTOINTEGERI64STRINGTRYINTOINTEGERU64STRINGTRYINTOINTEGERI32STRINGTRYINTOINTEGERU32STRINGTRYINTOINTEGERI16STRINGTRYINTOINTEGERU16STRINGTRYINTOINTEGERI8STRINGTRYINTOINTEGERU8STRINGTRYINTOINTEGERBITSTRINGTRYINTOIFIXUFIXSTRINGTRYINTOIFIXU64STRINGTRYINTOIFIXI32STRINGTRYINTOIFIXU32STRINGTRYINTOIFIXI16STRINGTRYINTOIFIXU16STRINGTRYINTOIFIXI8STRINGTRYINTOIFIXU8STRINGTRYINTOIFIXBITSTRINGTRYINTOUFIXI32STRINGTRYINTOUFIXU32STRINGTRYINTOUFIXI16STRINGTRYINTOUFIXU16STRINGTRYINTOUFIXI8STRINGTRYINTOUFIXU8STRINGTRYINTOUFIXBITSTRINGTRYINTOI64IFIXSTRINGTRYINTOI64UFIXSTRINGTRYINTOI64U64STRINGTRYINTOI64I32STRINGTRYINTOI64U32STRINGTRYINTOI64I16STRINGTRYINTOI64U16STRINGTRYINTOI64I8STRINGTRYINTOI64U8STRINGTRYINTOI64BITSTRINGTRYINTOU64IFIXSTRINGTRYINTOU64UFIXSTRINGTRYINTOU64I64STRINGTRYINTOU64I32STRINGTRYINTOU64U32STRINGTRYINTOU64I16STRINGTRYINTOU64U16STRINGTRYINTOU64I8STRINGTRYINTOU64U8STRINGTRYINTOU64BITSTRINGTRYINTOI32UFIXSTRINGTRYINTOI32U64STRINGTRYINTOI32U32STRINGTRYINTOI32I16STRINGTRYINTOI32U16STRINGTRYINTOI32I8STRINGTRYINTOI32U8STRINGTRYINTOI32BITSTRINGTRYINTOU32I32STRINGTRYINTOU32I16STRINGTRYINTOU32U16STRINGTRYINTOU32I8STRINGTRYINTOU32U8STRINGTRYINTOU32BITSTRINGTRYINTOI16UFIXSTRINGTRYINTOI16U64STRINGTRYINTOI16U32STRINGTRYINTOI16U16STRINGTRYINTOI16I8STRINGTRYINTOI16U8STRINGTRYINTOI16BITSTRINGTRYINTOU16I16STRINGTRYINTOU16I8STRINGTRYINTOU16U8STRINGTRYINTOU16BITSTRINGTRYINTOI8UFIXSTRINGTRYINTOI8U64STRINGTRYINTOI8U32STRINGTRYINTOI8U16STRINGTRYINTOI8U8STRINGTRYINTOI8BITSTRINGTRYINTOU8I8STRINGTRYINTOU8BITSTRINGTRYINTOF64FRACTIONSTRINGTRYINTOF32FRACTIONSTRING
UNWRAPPABLE [CLASS] · src
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 :: ((:B → :C) → (UNIT→ :C) → (:A :B) → :C)
Instances
Values
(< X Y) [FUNCTION] · src
∀ :A. ORD :A ⇒ (:A → :A → BOOLEAN)
Is x less than y?
(<= X Y) [FUNCTION] · src
∀ :A. ORD :A ⇒ (:A → :A → BOOLEAN)
Is x less than or equal to y?
(> X Y) [FUNCTION] · src
∀ :A. ORD :A ⇒ (:A → :A → BOOLEAN)
Is x greater than y?
(>= X Y) [FUNCTION] · src
∀ :A. ORD :A ⇒ (:A → :A → BOOLEAN)
Is x greater than or equal to y?
(>> A B) [FUNCTION] · src
∀ :A :B :C. MONAD :A ⇒ ((:A :B) → (:A :C) → (:A :C))
Equivalent to (>>= a (fn (_) b)).
(AS-OPTIONAL CONTAINER) [FUNCTION] · src
∀ :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] · src
∀ :A. (DEFAULT :A) (EQ :A) ⇒ (:A → BOOLEAN)
Is x the default item of its type?
(DEFAULTING-UNWRAP CONTAINER) [FUNCTION] · src
∀ :A :B. (UNWRAPPABLE :A) (DEFAULT :B) ⇒ ((:A :B) → :B)
Unwrap an unwrappable, returning (default) of the wrapped type on failure.
(EXPECT REASON CONTAINER) [FUNCTION] · src
∀ :A :B. UNWRAPPABLE :A ⇒ (STRING → (:A :B) → :B)
Unwrap container, signaling an error with the description reason on failure.
(JOIN M) [FUNCTION] · src
∀ :A :B. MONAD :A ⇒ ((:A (:A :B)) → (:A :B))
Equivalent to (>>= m id).
(MAP-FST F B) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :A. ORD :A ⇒ (:A → :A → :A)
Returns the greater element of x and y.
(MCOMMUTE? A B) [FUNCTION] · src
∀ :A. (EQ :A) (SEMIGROUP :A) ⇒ (:A → :A → BOOLEAN)
Does a <> b equal b <> a?
(MCONCAT A) [FUNCTION] · src
∀ :A :B. (FOLDABLE :A) (MONOID :B) ⇒ ((:A :B) → :B)
Fold a container of monoids into a single element.
(MCONCATMAP F A) [FUNCTION] · src
∀ :A :B :C. (FOLDABLE :C) (MONOID :B) ⇒ ((:A → :B) → (:C :A) → :B)
Map a container to a container of monoids, and then fold that container into a single element.
(MEMPTY? A) [FUNCTION] · src
∀ :A. (EQ :A) (MONOID :A) ⇒ (:A → BOOLEAN)
Does a equal (the Type mempty)?
(MIN X Y) [FUNCTION] · src
∀ :A. ORD :A ⇒ (:A → :A → :A)
Returns the lesser element of x and y.
(SEQUENCE) [FUNCTION] · src
∀ :A :B :C. (TRAVERSABLE :A) (APPLICATIVE :B) ⇒ ((:A (:B :C)) → (:B (:A :C)))
(UNWRAP CONTAINER) [FUNCTION] · src
∀ :A :B. UNWRAPPABLE :A ⇒ ((:A :B) → :B)
Unwrap container, signaling an error on failure.
(UNWRAP-INTO X) [FUNCTION] · src
∀ :A :B :C. TRYINTO :B :C :A ⇒ (:B → :C)
Same as tryInto followed by unwrap.
(WITH-DEFAULT DEFAULT CONTAINER) [FUNCTION] · src
∀ :A :B. UNWRAPPABLE :B ⇒ (:A → (:B :A) → :A)
Unwrap container, returning default on failure.
Package COALTON-LIBRARY/COMPUTABLE-REALS
Types
CREAL [TYPE] · src
Instances
COMPLEXCOMPONENTCREALDIVIDABLEINTEGERCREALELEMENTARYCREALEQCREALEXPONENTIABLECREALINTOF32CREALINTOF64CREALINTOFRACTIONCREALINTOI16CREALINTOI32CREALINTOI64CREALINTOI8CREALINTOIFIXCREALINTOINTEGERCREALINTOU16CREALINTOU32CREALINTOU64CREALINTOU8CREALINTOUFIXCREALNUMCREALORDCREALPOLARCREALQUANTIZABLECREALRADICALCREALREALCREALRECIPROCABLECREALRUNTIMEREPRCREALTRIGONOMETRICCREAL
Values
(APPROX X K) [FUNCTION] · src
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
$$ \vert a\cdot 2^{-\mathtt{k}} - \mathtt{x}\vert \leq 2^{-\mathtt{k}}. $$
See rational or rationalize to produce a rational approximation of
CReal.
(COMPARISON-THRESHOLD _) [FUNCTION] · src
∀ :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] · src
Prints a real x up to k bits of precision.
(RATIONAL-APPROX X K) [FUNCTION] · src
Produce a rational approximation of x called $r$ such that
$$ \vert r - \mathtt{x} \vert < 2^{-\mathtt{k}}. $$
(RATIONALIZE X K) [FUNCTION] · src
Produce a rational approximation of x called $r$ such that
$$ \vert r - \mathtt{x} \vert < 2^{-\mathtt{k}}, $$
taking into account the maximum precision specified by k to return
the simplest possible such approximation.
(SET-COMPARISON-THRESHOLD! K) [FUNCTION] · src
∀ :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/EXPERIMENTAL/LOOPS
A Coalton package of loop macros.
Note: (return), (break), and (continue) do not work inside any of these loop macros.
Macros
ARGBESTTIMES ((VARIABLE COUNT BETTER?) &BODY BODY) [MACRO]
The UFix in [0, count) which, when variable is bound to it, results in the evaluation of body which is better than the same for the rest of the UFixs in [0, count).
BESTTIMES ((VARIABLE COUNT BETTER?) &BODY BODY) [MACRO]
The result of evaluating body with variable bound to a UFix in [0, count) that is better? than the result of evaluating body with variable bound to the rest of the UFixs in [0, count)..
COLLECTTIMES ((VARIABLE COUNT) &BODY BODY) [MACRO]
Collect the results of evaluating body for variable bound to every UFix in [0, count) as a List.
DOLIST ((VARIABLE LIS) &BODY BODY) [MACRO]
Perform body with variable bound to every element of lis.
DOLIST-ENUMERATED ((INDEX-VARIABLE ELEMENT-VARIABLE LIS) &BODY BODY) [MACRO]
Perform body with element-variable bound to the elements of lis and index-variable bound to their indices.
DOLISTS (VARIABLES-AND-LISTS &BODY BODY) [MACRO]
Perform body with the variables bound to the elements of the lists. See the example below.
Example:
> (coalton (dolists ((x (make-list 1 2 3))
(y (make-list 10 20 30))
(z (make-list 100 200 300 400)))
(print (+ x (+ y z))))
111
222
333
COALTON::UNIT/UNIT
DORANGE ((VARIABLE START-OR-STOP &OPTIONAL STOP STEP) &BODY BODY) [MACRO]
Perform body with variable bound to elements of a discrete range.
If only start-or-stop is supplied, then the range is from 0 (inclusive) to start-or-stop (exclusive) by increments or decrements of 1.
> (coalton (dorange (x 3) (print x)))
0
1
2
COALTON::UNIT/UNIT
> (coalton (dorange (x -3) (print x)))
0
-1
-2
COALTON::UNIT/UNIT
If only start-or-stop and stop are supplied, then the range is from start-or-stop (inclusive) to stop (exclusive) by increments or decrements of 1.
> (coalton (dorange (x -2 2) (print x)))
-2
-1
0
1
COALTON::UNIT/UNIT
> (coalton (dorange (x 0.5 -2) (print x)))
0.5
-0.5
-1.5
COALTON::UNIT/UNIT
Otherwise, the range is from start-or-stop (inclusive) to stop (exclusive) by step. step must be the correct sign, or dorange does nothing.
> (coalton (dorange -2 2 2) (print x))
-2
0
COALTON::UNIT/UNIT
> (coalton (dorange -2 2 -1) (print x))
COALTON::UNIT/UNIT
DOTIMES ((VARIABLE COUNT) &BODY BODY) [MACRO]
Perform body with variable bound to every UFix in [0, count) sequentially.
EVERYTIMES ((VARIABLE COUNT) &BODY BODY) [MACRO]
Does body evaluate to True for variable bound to every UFix in [0, count). Returns True if (zero? count).
PRODTIMES ((VARIABLE COUNT) &BODY BODY) [MACRO]
The product of body for variable bount to every UFix in [0, count).
REPEAT ((COUNT) &BODY BODY) [MACRO]
Perform body count times.
SOMETIMES ((VARIABLE COUNT) &BODY BODY) [MACRO]
Does body evaluate to True for variable bound to some UFix in [0, count). Returns False if (zero? count).
SUMTIMES ((VARIABLE COUNT) &BODY BODY) [MACRO]
The sum of body for variable bount to every UFix in [0, count).
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] · src
(PATHERRORSTRINGPATHNAME)(LISPERRORLISPCONDITION)(FILEERRORSTRING)EOF
Errors for file functions.
Instances
FILESTREAM [TYPE] · src
Represents a file stream, using cl:file-stream.
Instances
RUNTIMEREPR (FILESTREAM:A)
IFEXISTS [TYPE] · src
SUPERSEDEOVERWRITEEERRORAPPEND
Possible options for opening a stream when the file exists.
Instances
PATHNAME [TYPE] · src
Pathname object. Equivalent to cl:pathname
Instances
STREAMOPTIONS [TYPE] · src
(BIDIRECTIONALPATHNAMEIFEXISTS)- Constructor for opening a bidirectional stream.
(OUTPUTPATHNAMEIFEXISTS)- Constructor for opening an output stream.
(INPUTPATHNAME)- Constructor for opening an input stream
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] · src
FILE :A
A class of types which are able to be written to or read from a file.
Methods:
OPEN :: (STREAMOPTIONS→ (RESULTFILEERROR(FILESTREAM:A)))READ :: ((FILESTREAM:A) → (RESULTFILEERROR:A))WRITE :: ((FILESTREAM:A) → :A → (RESULTFILEERRORUNIT))
Instances
Values
(ABORT STREAM) [FUNCTION] · src
∀ :A :B. ((FILESTREAM :A) → (RESULT FILEERROR :B))
Closes a FileStream and aborts all operations..
(APPEND-TO-FILE! PATH DATA) [FUNCTION] · src
∀ :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] · src
∀ :A :B. ((FILESTREAM :A) → (RESULT FILEERROR :B))
Closes a FileStream.
(COPY! INPUT OUTPUT) [FUNCTION] · src
∀ :A :B. (INTO :A PATHNAME) (INTO :B PATHNAME) ⇒ (:A → :B → (RESULT FILEERROR UNIT))
Copies a file to a new location.
(CREATE-DIRECTORY! PATH) [FUNCTION] · src
∀ :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] · src
(UNIT → (RESULT FILEERROR PATHNAME))
This configures a default temporary directory for use.
(CREATE-TEMP-FILE! FILE-EXT) [FUNCTION] · src
(STRING → (RESULT FILEERROR PATHNAME))
This configures a default temporary file for use.
(DELETE-FILE! PATH) [FUNCTION] · src
∀ :A. INTO :A PATHNAME ⇒ (:A → (RESULT FILEERROR UNIT))
Deletes a given file if the file exists.
(DIRECTORY-EXISTS? PATH) [FUNCTION] · src
∀ :A. INTO :A PATHNAME ⇒ (:A → (RESULT FILEERROR BOOLEAN))
Returns True if a pathname names a directory that exists.
(DIRECTORY-FILES PATH) [FUNCTION] · src
∀ :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] · src
∀ :A. INTO :A PATHNAME ⇒ (:A → BOOLEAN)
Returns True if a pathname has no file component.
(EMPTY? PATH) [FUNCTION] · src
∀ :A. INTO :A PATHNAME ⇒ (:A → (RESULT FILEERROR BOOLEAN))
Checks whether a directory is empty.
(EXISTS? PATH) [FUNCTION] · src
∀ :A. INTO :A PATHNAME ⇒ (:A → (RESULT FILEERROR BOOLEAN))
Returns whether a file or directory exists.
(FILE-EXISTS? PATH) [FUNCTION] · src
∀ :A. INTO :A PATHNAME ⇒ (:A → (RESULT FILEERROR BOOLEAN))
Returns True if a pathname names a file that exists.
(FILE-PATHNAME? PATH) [FUNCTION] · src
∀ :A. INTO :A PATHNAME ⇒ (:A → BOOLEAN)
Returns True if a pathname has a file component.
(FILE-POSITION STREAM) [FUNCTION] · src
∀ :A. ((FILESTREAM :A) → (RESULT FILEERROR UFIX))
Finds the file-position of a file stream.
(FLUSH STREAM) [FUNCTION] · src
∀ :A :B. ((FILESTREAM :A) → (RESULT FILEERROR :B))
Blocks until stream has been flushed. Calls cl:finish-output.
(MERGE PATH1 PATH2) [FUNCTION] · src
∀ :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] · src
((FILESTREAM CHAR) → (RESULT FILEERROR CHAR))
Reads a character from an FileStream.
(READ-FILE-LINES PATH) [FUNCTION] · src
∀ :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] · src
∀ :A. INTO :A PATHNAME ⇒ (:A → (RESULT FILEERROR STRING))
Reads a file into a string, given a pathname string.
(READ-FILE-TO-VECTOR STREAM) [FUNCTION] · src
∀ :A. FILE :A ⇒ ((FILESTREAM :A) → (RESULT FILEERROR (VECTOR :A)))
Reads a file into a vector of type :a.
(READ-VECTOR STREAM CHUNK-SIZE) [FUNCTION] · src
∀ :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] · src
∀ :A. INTO :A PATHNAME ⇒ (:A → (RESULT FILEERROR :A))
Deletes an empty directory.
(REMOVE-DIRECTORY-RECURSIVE! PATH) [FUNCTION] · src
∀ :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] · src
∀ :A. ((FILESTREAM :A) → UFIX → (RESULT FILEERROR UNIT))
Sets the file position of a file stream.
(SUBDIRECTORIES PATH) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :A. ((PATHNAME → (RESULT FILEERROR :A)) → (RESULT FILEERROR :A))
Performs an operation thunk inside a temporary directory.
(WITH-TEMP-FILE FILE-TYPE THUNK) [FUNCTION] · src
∀ :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] · src
((FILESTREAM CHAR) → CHAR → (RESULT FILEERROR UNIT))
Writes a Char to the stream.
(WRITE-LINE STREAM S) [FUNCTION] · src
((FILESTREAM CHAR) → STRING → (RESULT FILEERROR UNIT))
Writes a string with an appended newline to a filestream of type Char.
(WRITE-STRING FS S) [FUNCTION] · src
((FILESTREAM CHAR) → STRING → (RESULT FILEERROR UNIT))
Writes a string to a FileStream of type Char.
(WRITE-TO-FILE! PATH DATA) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :A. EQ :A ⇒ (:A → :A → BOOLEAN)
Is a not equal to b?
(ASUM XS) [FUNCTION] · src
∀ :A :B :C. (ALTERNATIVE :B) (FOLDABLE :A) ⇒ ((:A (:B :C)) → (:B :C))
Fold over a list using alt.
(BRACKET INIT EXIT BODY) [FUNCTION] · src
∀ :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] · src
∀ :A. ((:A → BOOLEAN) → :A → BOOLEAN)
Compute the complement of a unary Boolean function.
(COMPOSE F G X) [FUNCTION] · src
∀ :A :B :C. ((:A → :B) → (:C → :A) → :C → :B)
Equivalent to (f (g x)).
(CONJOIN F G X) [FUNCTION] · src
∀ :A. ((:A → BOOLEAN) → (:A → BOOLEAN) → :A → BOOLEAN)
Compute the conjunction of two unary Boolean functions.
(CONST A _B) [FUNCTION] · src
∀ :A :B. (:A → :B → :A)
A function that always returns its first argument.
(CURRY FUNC LEFT RIGHT) [FUNCTION] · src
∀ :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] · src
∀ :A. ((:A → BOOLEAN) → (:A → BOOLEAN) → :A → BOOLEAN)
Compute the disjunction of two unary Boolean functions.
(FIX F N) [FUNCTION] · src
∀ :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] · src
∀ :A :B :C. ((:A → :B → :C) → :B → :A → :C)
Returns a function that takes its arguments in reverse order.
(ID X) [FUNCTION] · src
∀ :A. (:A → :A)
A function that always returns its argument.
(MSUM XS) [FUNCTION] · src
∀ :A :B. (MONOID :B) (FOLDABLE :A) ⇒ ((:A :B) → :B)
Fold over a list using <>.
(PAIR-WITH FUNC LEFT) [FUNCTION] · src
∀ :A :B. ((:A → :B) → :A → (TUPLE :A :B))
Create a Tuple of the form (Tuple left (func left)).
(PRINT ITEM) [FUNCTION] · src
∀ :A. INTO :A STRING ⇒ (:A → UNIT)
Print the String representation of item to cl:*standard-output*.
(REDUCE F Y XS) [FUNCTION] · src
∀ :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] · src
Print a line to cl:*standard-output*.
(TRACEOBJECT STR ITEM) [FUNCTION] · src
Print a line to cl:*standard-output* in the form “{STR}: {ITEM}”.
(UNCURRY FUNC TPL) [FUNCTION] · src
∀ :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] · src
∀ :A. (:A → :A → BOOLEAN)
Macros
CONJOIN* (&REST PREDICATES) [MACRO]
Compute the conjuction of predicates.
For example, the following expressions are equivalent.
(conjoin* f g h)
(fn (x) (and (f x) (g x) (h x)))
DISJOIN* (&REST PREDICATES) [MACRO]
Compute the disjunction of predicates.
For example, the following expressions are equivalent.
(disjoin* f g h)
(fn (x) (or (f x) (g x) (h x)))
Package COALTON-LIBRARY/HASH
Values
(COMBINE-HASHES LHS RHS) [FUNCTION] · src
(COMBINE-HASHES-ORDER-INDEPENDENT LHS RHS) [FUNCTION] · src
Package COALTON-LIBRARY/HASHMAP
Types
HASHMAP [TYPE] · src
(HASHMAP (HMNODE:A :B))
Immutable map (also known as a dictionary or dict) using hashes. Implemented as a hash array mapped trie data structure.
Instances
Values
(COUNT HM) [FUNCTION] · src
∀ :A :B. ((HASHMAP :A :B) → INTEGER)
Returns the number of entries in HM.
(EMPTY? HM) [FUNCTION] · src
∀ :A :B. ((HASHMAP :A :B) → BOOLEAN)
Returns True if a hashmap HM is empty, False if not.
(INSERT HM KEY VAL) [FUNCTION] · src
∀ :A :B. HASH :A ⇒ ((HASHMAP :A :B) → :A → :B → (HASHMAP :A :B))
Returns a hashmap that has a new entry of (KEY, VAL) added to HM. If HM containes an entry with KEY, the new hashmap replaces it for the new entry.
(KEYS HM) [FUNCTION] · src
∀ :A :B. HASH :A ⇒ ((HASHMAP :A :B) → (ITERATOR :A))
Returns an interator to iterate over all the keys in a hashmap hm.
(LOOKUP HM KEY) [FUNCTION] · src
∀ :A :B. HASH :A ⇒ ((HASHMAP :A :B) → :A → (OPTIONAL :B))
Returns a value associated with KEY in the hashmap HM.
(REMOVE HM KEY) [FUNCTION] · src
∀ :A :B. HASH :A ⇒ ((HASHMAP :A :B) → :A → (HASHMAP :A :B))
Returns a hashmap that is identical to HM except the entry with KEY is removed. If HM does not contain an entry with KEY, HM is returned as is.
(VALUES HM) [FUNCTION] · src
∀ :A :B. HASH :A ⇒ ((HASHMAP :A :B) → (ITERATOR :B))
Returns an interator to iterate over all the values in a hashmap hm.
EMPTY [VALUE] · src
∀ :A :B. (HASHMAP :A :B)
An empty HashMap
Package COALTON-LIBRARY/HASHTABLE
Types
HASHTABLE [TYPE] · src
A mutable hash table.
Instances
Values
(COUNT TABLE) [FUNCTION] · src
∀ :A :B. ((HASHTABLE :A :B) → INTEGER)
Returns the number of entries in TABLE
(ENTRIES TABLE) [FUNCTION] · src
∀ :A :B. ((HASHTABLE :A :B) → (ITERATOR (TUPLE :A :B)))
Returns the key-values pairs as a list.
(EXTEND! TABLE ITER) [FUNCTION] · src
∀ :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] · src
∀ :A :B. HASH :A ⇒ ((HASHTABLE :A :B) → :A → (OPTIONAL :B))
Lookup KEY in TABLE
(KEYS TABLE) [FUNCTION] · src
∀ :A :B. ((HASHTABLE :A :B) → (ITERATOR :A))
Returns the keys in TABLE as a list
(NEW _) [FUNCTION] · src
∀ :A :B. HASH :A ⇒ (UNIT → (HASHTABLE :A :B))
Create a new empty hashtable
(REMOVE! TABLE KEY) [FUNCTION] · src
∀ :A :B. HASH :A ⇒ ((HASHTABLE :A :B) → :A → UNIT)
Remove the entry at KEY from TABLE
(SET! TABLE KEY VALUE) [FUNCTION] · src
∀ :A :B. HASH :A ⇒ ((HASHTABLE :A :B) → :A → :B → UNIT)
Set KEY to VALUE in TABLE
(VALUES TABLE) [FUNCTION] · src
∀ :A :B. ((HASHTABLE :A :B) → (ITERATOR :B))
Returns the values in TABLE as a list
(WITH-CAPACITY CAPACITY) [FUNCTION] · src
∀ :A :B. HASH :A ⇒ (INTEGER → (HASHTABLE :A :B))
Create a new empty hashtable with a given capacity
Package COALTON-LIBRARY/ITERATOR
Types
ITERATOR [TYPE] · src
A forward-moving pointer into an ordered sequence of :ELTs
Instances
FUNCTORITERATORINTOITERATOR (ITERATOR:A) :ARUNTIMEREPR (ITERATOR:A)
Classes
FROMITERATOR [CLASS] · src
FROMITERATOR :A :B
Methods:
COLLECT! :: ((ITERATOR:B) → :A)
Instances
RUNTIMEREPR :A ⇒ FROMITERATOR (SEQ:A) :AORD :A ⇒ FROMITERATOR (ORDMAP:A :B) (TUPLE:A :B)ORD :A ⇒ FROMITERATOR (TREE:A) :AFROMITERATOR (QUEUE:A) :AHASH :A ⇒ FROMITERATOR (HASHMAP:A :B) (TUPLE:A :B)HASH :A ⇒ FROMITERATOR (HASHTABLE:A :B) (TUPLE:A :B)FROMITERATOR (SLICE:A) :AFROMITERATORSTRINGCHARFROMITERATOR (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] · src
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 (ORDMAP:A :B) (TUPLE:A :B)INTOITERATOR (TREE:A) :AINTOITERATOR (QUEUE:A) :AINTOITERATOR (HASHMAP:A :B) (TUPLE:A :B)INTOITERATOR (HASHTABLE:A :B) (TUPLE:A :B)INTOITERATOR (SLICE:A) :AINTOITERATORSTRINGCHARINTOITERATOR (VECTOR:A) :AINTOITERATOR (LIST:A) :AINTOITERATOR (RESULT:A :B) :BINTOITERATOR (OPTIONAL:A) :AINTOITERATOR (ITERATOR:A) :A
Values
(AND! ITER) [FUNCTION] · src
((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] · src
∀ :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] · src
∀ :A. ((ITERATOR :A) → (ITERATOR :A) → (ITERATOR :A))
Yield all the elements of ITER1 followed by all the elements from ITER2.
(COUNT! ITER) [FUNCTION] · src
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] · src
∀ :A. (NUM :A) (ORD :A) ⇒ (UNIT → (ITERATOR :A))
An infinite iterator which starts at 0 and counts upwards by 1.
(DOWN-FROM LIMIT) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :A. ((ITERATOR :A) → (ITERATOR (TUPLE UFIX :A)))
Pair successive zero-based incides with elements from ITER
(EVERY! GOOD? ITER) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :A :B. ((:A → (OPTIONAL :B)) → (ITERATOR :A) → (ITERATOR :B))
Map an iterator, retaining only the elements where F returns SOME.
(FIND! THIS? ITER) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :A :B. ((:A → (ITERATOR :B)) → (ITERATOR :A) → (ITERATOR :B))
Flatten! wrapped around map.
(FLATTEN! ITERS) [FUNCTION] · src
∀ :A. ((ITERATOR (ITERATOR :A)) → (ITERATOR :A))
Yield all the elements from each of the ITERS in order.
(FOLD! FUNC INIT ITER) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :A. ((ITERATOR :A) → (OPTIONAL :A))
Yields the last element of ITER, completely consuming it.
(MAP-WHILE! F ITER) [FUNCTION] · src
∀ :A :B. ((:A → (OPTIONAL :B)) → (ITERATOR :A) → (ITERATOR :B))
Map an iterator, stopping early if F returns NONE.
(MAX! ITER) [FUNCTION] · src
∀ :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] · src
∀ :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.
(MCONCAT! ITER) [FUNCTION] · src
∀ :A. MONOID :A ⇒ ((ITERATOR :A) → :A)
Fold an iterator of monoids into a single element.
(MCONCATMAP! FUNC ITER) [FUNCTION] · src
∀ :A :B. MONOID :B ⇒ ((:A → :B) → (ITERATOR :A) → :B)
Map an iterator to an iterator of monoids, and then fold that iterator into a single element.
(MIN! ITER) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :A. ((UNIT → (OPTIONAL :A)) → (ITERATOR :A))
Create a new iterator from a function that yields elements.
(NEXT! ITER) [FUNCTION] · src
∀ :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] · src
∀ :A. (:A → (ITERATOR :A))
Yield item once.
(OPTIMIZE! BETTER? ITER) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
((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] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :A. HASH :A ⇒ ((ITERATOR :A) → (ITERATOR :A))
Yield unique elements from ITER in order of first appearance.
(REPEAT ITEM) [FUNCTION] · src
∀ :A. (:A → (ITERATOR :A))
Yield ITEM over and over, infinitely.
(REPEAT-FOR ITEM COUNT) [FUNCTION] · src
∀ :A. (:A → UFIX → (ITERATOR :A))
Yield ITEM COUNT times, then stop.
(SIZE-HINT ITER) [FUNCTION] · src
∀ :A. ((ITERATOR :A) → (OPTIONAL UFIX))
(SUM! ITER) [FUNCTION] · src
∀ :A. NUM :A ⇒ ((ITERATOR :A) → :A)
Add together all the elements of ITER.
(TAKE! COUNT ITER) [FUNCTION] · src
∀ :A. (UFIX → (ITERATOR :A) → (ITERATOR :A))
An Iterator which yields at most COUNT elements from ITER.
(UNWRAPPED! ITER) [FUNCTION] · src
∀ :A :B. UNWRAPPABLE :A ⇒ ((ITERATOR (:A :B)) → (ITERATOR :B))
(UP-THROUGH LIMIT) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :A. ((UNIT → (OPTIONAL :A)) → UFIX → (ITERATOR :A))
(ZIP!) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :A. (ITERATOR :A)
Yields nothing; stops immediately
Package COALTON-LIBRARY/LISPARRAY
Types
LISPARRAY [TYPE] · src
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
EQ :A ⇒ EQ (LISPARRAY:A)FOLDABLELISPARRAYINTO (LISPARRAY:A) (LIST:A)RUNTIMEREPR :A ⇒ INTO (LIST:A) (LISPARRAY:A)RUNTIMEREPR :A ⇒ ISO (LISPARRAY:A) (LIST:A)RUNTIMEREPR :A ⇒ RANDOMACCESS (LISPARRAY:A) :ARUNTIMEREPR :A ⇒ RUNTIMEREPR (LISPARRAY:A)
Values
(AREF V I) [FUNCTION] · src
∀ :A. ((LISPARRAY :A) → UFIX → :A)
Read the ith value of the LispArray v.
(COPY V) [FUNCTION] · src
∀ :A. ((LISPARRAY :A) → (LISPARRAY :A))
Make a deep copy of the LispArray v.
(LENGTH V) [FUNCTION] · src
Return the length of the LispArray v.
(MAKE N X) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :A. ((LISPARRAY :A) → UFIX → :A → UNIT)
Set the ith value of the LispArray v to x.
Package COALTON-LIBRARY/LIST
Values
(ALL F? XS) [FUNCTION] · src
∀ :A. ((:A → BOOLEAN) → (LIST :A) → BOOLEAN)
Returns True if every element in xs matches f?.
(ANY F? L) [FUNCTION] · src
∀ :A. ((:A → BOOLEAN) → (LIST :A) → BOOLEAN)
Returns True if at least one element in xs matches f?.
(APPEND XS YS) [FUNCTION] · src
∀ :A. ((LIST :A) → (LIST :A) → (LIST :A))
Appends two lists together and returns a new list.
(CAR X) [FUNCTION] · src
∀ :A. ((LIST :A) → :A)
Return the traditional car of a list. This function is partial
(CDR XS) [FUNCTION] · src
Return the traditional cdr of a list.
(COMBS L) [FUNCTION] · src
∀ :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 this function.
(COMBSOF N L) [FUNCTION] · src
∀ :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] · src
∀ :A. ((LIST (LIST :A)) → (LIST :A))
Appends a list of lists together into a single new list.
(CONCATMAP F XS) [FUNCTION] · src
∀ :A :B. ((:A → (LIST :B)) → (LIST :A) → (LIST :B))
Apply F to each element in XS and concatenate the results.
(CONS? XS) [FUNCTION] · src
Returns TRUE if XS is a non-empty list.
(COUNTBY F THINGS) [FUNCTION] · src
∀ :A. ((:A → BOOLEAN) → (LIST :A) → UFIX)
Count the number of items in THINGS that satisfy the predicate F.
(DIFFERENCE XS YS) [FUNCTION] · src
∀ :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] · src
∀ :A. (UFIX → (LIST :A) → (LIST :A))
Returns a list with the first N elements removed.
(ELEMINDEX X XS) [FUNCTION] · src
∀ :A. EQ :A ⇒ (:A → (LIST :A) → (OPTIONAL UFIX))
(EQUIVALENCE-CLASSES) [FUNCTION] · src
∀ :A. EQ :A ⇒ ((LIST :A) → (LIST (LIST :A)))
(EQUIVALENCE-CLASSES-BY F L) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :A. ((:A → BOOLEAN) → (LIST :A) → (OPTIONAL :A))
Returns the first element in a list matching the predicate function F.
(FINDINDEX F XS) [FUNCTION] · src
∀ :A. ((:A → BOOLEAN) → (LIST :A) → (OPTIONAL UFIX))
Returns the index of the first element matching the predicate function F.
(HEAD L) [FUNCTION] · src
∀ :A. ((LIST :A) → (OPTIONAL :A))
Returns the first element of a list.
(INDEX I XS) [FUNCTION] · src
∀ :A. (UFIX → (LIST :A) → (OPTIONAL :A))
Returns the Ith element of a list.
(INIT L) [FUNCTION] · src
Returns every element except the last in a list.
(INSERT E LS) [FUNCTION] · src
∀ :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] · src
∀ :A. ((:A → :A → ORD) → :A → (LIST :A) → (LIST :A))
Generic version of insert
(INSERTIONS A L) [FUNCTION] · src
∀ :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] · src
∀ :A. ((LIST :A) → (LIST (LIST :A)) → (LIST :A))
Intersperse xs into xss and then concatenate the result.
(INTERSECTION XS YS) [FUNCTION] · src
∀ :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] · src
∀ :A. (:A → (LIST :A) → (LIST :A))
Returns a new list by inserting e between every element of xs.
(LAST L) [FUNCTION] · src
∀ :A. ((LIST :A) → (OPTIONAL :A))
Returns the last element of a list.
(LENGTH L) [FUNCTION] · src
Returns the length of a list.
(LOOKUP E XS) [FUNCTION] · src
∀ :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] · src
∀ :A. ORD :A ⇒ ((LIST :A) → (OPTIONAL :A))
Returns a greatest element of a list, or None.
(MEMBER E XS) [FUNCTION] · src
∀ :A. EQ :A ⇒ (:A → (LIST :A) → BOOLEAN)
Returns true if any element of XS is equal to E.
(MINIMUM L) [FUNCTION] · src
∀ :A. ORD :A ⇒ ((LIST :A) → (OPTIONAL :A))
Returns a least element of a list, or None.
(NTH N L) [FUNCTION] · src
Like INDEX, but errors if the index is not found.
(NTH-CDR N L) [FUNCTION] · src
∀ :A. (UFIX → (LIST :A) → (LIST :A))
Returns the nth-cdr of a list.
(NULL? XS) [FUNCTION] · src
Returns TRUE if XS is an empty list.
(OPTIMUMBY F XS) [FUNCTION] · src
∀ :A. ((:A → :A → BOOLEAN) → (LIST :A) → (OPTIONAL :A))
Returns an optimum according to a total order.
(PARTITION F XS) [FUNCTION] · src
∀ :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] · src
∀ :A. ((LIST :A) → (LIST (LIST :A)))
Produce all permutations of the list L.
(PRODUCT XS) [FUNCTION] · src
∀ :A. NUM :A ⇒ ((LIST :A) → :A)
Returns the product of xs.
(RANGE START END) [FUNCTION] · src
∀ :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] · src
∀ :A. EQ :A ⇒ (:A → (LIST :A) → (LIST :A))
Return a new list with the first element equal to x removed.
(REMOVE-DUPLICATES XS) [FUNCTION] · src
∀ :A. EQ :A ⇒ ((LIST :A) → (LIST :A))
Returns a new list without duplicate elements.
(REMOVE-IF PRED XS) [FUNCTION] · src
∀ :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] · src
Returns a list with the same value repeated multiple times.
(REVERSE XS) [FUNCTION] · src
Returns a new list containing the same elements in reverse order.
(SINGLETON X) [FUNCTION] · src
∀ :A. (:A → (LIST :A))
Returns a list containing one element.
(SINGLETON? XS) [FUNCTION] · src
Is xs a list containing exactly one element?
(SORT XS) [FUNCTION] · src
∀ :A. ORD :A ⇒ ((LIST :A) → (LIST :A))
Sort xs.
(SORTBY CMP XS) [FUNCTION] · src
∀ :A. ((:A → :A → ORD) → (LIST :A) → (LIST :A))
Sort xs by a custom comparison function cmp.
(SPLIT C STR) [FUNCTION] · src
(CHAR → STRING → (LIST STRING))
Split a string str into a list of substrings by the character c.
(SUM XS) [FUNCTION] · src
∀ :A. NUM :A ⇒ ((LIST :A) → :A)
Returns the sum of xs.
(TAIL L) [FUNCTION] · src
∀ :A. ((LIST :A) → (OPTIONAL (LIST :A)))
Returns every element except the first in a list.
(TAKE N XS) [FUNCTION] · src
∀ :A. (UFIX → (LIST :A) → (LIST :A))
Returns the first N elements of a list.
(TRANSPOSE XS) [FUNCTION] · src
∀ :A. ((LIST (LIST :A)) → (LIST (LIST :A)))
Transposes a matrix represented by a list of lists.
(UNION XS YS) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :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
Macros
MAKE (&REST ELEMENTS) [MACRO]
Make a homogeneous list of elements. Synonym for coalton:make-list.
Package COALTON-LIBRARY/MATH/ARITH
Classes
DIVIDABLE [CLASS] · src
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 Integers can result in a Fraction, whereas
(Dividable F32 F32)
establishes that division of two F32s can result in a F32.
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] · src
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
RECIPROCABLECREALRECIPROCABLEBIG-FLOATRECIPROCABLE :A ⇒ RECIPROCABLE (HYPERDUAL:A)RECIPROCABLE :A ⇒ RECIPROCABLE (DUAL:A)(COMPLEXCOMPONENT :A) (RECIPROCABLE :A) ⇒ RECIPROCABLE (COMPLEX:A)RECIPROCABLEFRACTIONRECIPROCABLEF64RECIPROCABLEF32
TRANSFINITE [CLASS] · src
TRANSFINITE :A
Numeric type with a value for (positive) infinity and/or NaN.
Methods:
Instances
Values
(1+ NUM) [FUNCTION] · src
∀ :A. NUM :A ⇒ (:A → :A)
Increment num.
(1- NUM) [FUNCTION] · src
∀ :A. NUM :A ⇒ (:A → :A)
Decrement num.
(ABS X) [FUNCTION] · src
∀ :A. (ORD :A) (NUM :A) ⇒ (:A → :A)
Absolute value of x.
(ASH X N) [FUNCTION] · src
Compute the “arithmetic shift” of x by n.
(FINITE? X) [FUNCTION] · src
∀ :A. TRANSFINITE :A ⇒ (:A → BOOLEAN)
Neither infinite or NaN.
(NEGATE X) [FUNCTION] · src
∀ :A. NUM :A ⇒ (:A → :A)
The negation, or additive inverse, of x.
(NEGATIVE? X) [FUNCTION] · src
∀ :A. (NUM :A) (ORD :A) ⇒ (:A → BOOLEAN)
Is x negative?
(NONNEGATIVE? X) [FUNCTION] · src
∀ :A. (NUM :A) (ORD :A) ⇒ (:A → BOOLEAN)
Is x not negative?
(NONPOSITIVE? X) [FUNCTION] · src
∀ :A. (NUM :A) (ORD :A) ⇒ (:A → BOOLEAN)
Is x not positive?
(NONZERO? X) [FUNCTION] · src
Is x not zero?
(POSITIVE? X) [FUNCTION] · src
∀ :A. (NUM :A) (ORD :A) ⇒ (:A → BOOLEAN)
Is x positive?
(SIGN X) [FUNCTION] · src
∀ :A :B. (ORD :A) (NUM :A) (NUM :B) ⇒ (:A → :B)
The sign of x, where (sign 0) = 1.
(ZERO? X) [FUNCTION] · src
Is x zero?
NEGATIVE-INFINITY [VALUE] · src
∀ :A. (TRANSFINITE :A) (NUM :A) ⇒ :A
Package COALTON-LIBRARY/MATH/BOUNDED
Classes
BOUNDED [CLASS] · src
BOUNDED :A
Types which have a maximum and minumum bound.
Methods:
MINBOUND :: :AMAXBOUND :: :A
Instances
Package COALTON-LIBRARY/MATH/COMPLEX
Types
COMPLEX [TYPE] · src
A complex number with a real and imaginary component.
This object does not have any public constructors. Instead, use the
function complex of the ComplexComponent type class.
A Complex object may either have a native or constructed
representation. See the ComplexComponent type class for allowed
component types.
Instances
(COMPLEXCOMPONENT :A) (INTO :A (HYPERDUAL:A)) ⇒ INTO (COMPLEX:A) (COMPLEX(HYPERDUAL:A))(COMPLEXCOMPONENT :A) (INTO :ACREAL) ⇒ INTO (COMPLEX:A) (COMPLEXCREAL)(COMPLEXCOMPONENT :A) (RECIPROCABLE :A) ⇒ RECIPROCABLE (COMPLEX:A)COMPLEXCOMPONENT :A ⇒ EQ (COMPLEX:A)COMPLEXCOMPONENT :A ⇒ INTO :A (COMPLEX:A)COMPLEXCOMPONENT :A ⇒ NUM (COMPLEX:A)ELEMENTARY :A ⇒ EXPONENTIABLE (COMPLEX:A)ELEMENTARY :A ⇒ RADICAL (COMPLEX:A)ELEMENTARY :A ⇒ TRIGONOMETRIC (COMPLEX:A)FFTCYCLICGROUP (COMPLEXF64)FFTCYCLICGROUP (COMPLEXF32)FFTFIELD (COMPLEXF64)FFTFIELD (COMPLEXF32)FFTGROUP (COMPLEXF64)FFTGROUP (COMPLEXF32)FFTRING (COMPLEXF64)FFTRING (COMPLEXF32)RUNTIMEREPR :A ⇒ RUNTIMEREPR (COMPLEX:A)
Classes
COMPLEXCOMPONENT [CLASS] · src
NUM :A ⇒ COMPLEXCOMPONENT :A
A type class for describing complex component types. This type class
also encodes the construction and projection of Complex data types.
Methods:
COMPLEX :: (:A → :A → (COMPLEX:A))REAL-PART :: ((COMPLEX:A) → :A)IMAG-PART :: ((COMPLEX:A) → :A)
Instances
Values
(CONJUGATE Z) [FUNCTION] · src
∀ :A. COMPLEXCOMPONENT :A ⇒ ((COMPLEX :A) → (COMPLEX :A))
The complex conjugate. If $z=a+bi$ then the conjugate $\bar z=a-bi$.
(SQUARE-MAGNITUDE Z) [FUNCTION] · src
∀ :A. COMPLEXCOMPONENT :A ⇒ ((COMPLEX :A) → :A)
The squared length of a complex number: $$\vert z\vert^2=(\operatorname{Re} z)^2+(\operatorname{Im} z)^2.$$
II [VALUE] · src
∀ :A. COMPLEXCOMPONENT :A ⇒ (COMPLEX :A)
The complex unit $i=\sqrt{-1}$. (The double ii represents a
blackboard-bold 𝕚.)
Package COALTON-LIBRARY/MATH/DUAL
Dual numbers are a hypercomplex number system [1]. A dual number has the form $a + b\varepsilon$ where $a$ and $b$ are real numbers and $\varepsilon$ is a symbol that satisfies $\varepsilon^2=0$ and $\varepsilon\neq 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^{\prime}(4)$. By the usual rules of differentiation, we know $f^{\prime}(x) = 3$ and thus $(f(4), f^{\prime}(4)) = (14, 3)$. We seek to recover this with dual numbers.
With dual numbers, we can calculate
$$f(a) + f^{\prime}(a)\varepsilon$$
by taking a real-valued function $f$ and evaluating as if it were a dual-valued function at the point $a + \varepsilon$. Thus, for the defined $f$, we have:
$$ \begin{aligned} f(4 + \varepsilon) &= 3(4 + \varepsilon) + 2 \\ &= 3\cdot 4 + 3\varepsilon + 2 \\ &= 14 + 3\varepsilon. \end{aligned} $$
In this result, the primal $14$ is the value of $f(4)$ and the dual is the value of of $f^{\prime}(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] · src
Representation of a dual number in the form $a + b\varepsilon$ where $a$ and $b$ are real numbers and $\varepsilon$ satisfies $\varepsilon^2 = 0$ and $\varepsilon \neq 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] · src
∀ :A. ((DUAL :A) → :A)
The dual (i.e., derivative) part of a dual number.
(PRIMAL-PART (DUAL P _)) [FUNCTION] · src
∀ :A. ((DUAL :A) → :A)
The primal (i.e., real) part of a dual number.
Package COALTON-LIBRARY/MATH/DYADIC
Types
DYADIC [TYPE] · src
(Dyadic n k) represents the rational $\mathtt{n}\cdot 2^{\mathtt{k}}$.
Instances
Values
(SCALE X J) [FUNCTION] · src
Scales a dyadic x by $2^{\mathtt{k}}$.
(SHIFT K A) [FUNCTION] · src
Shift dyadic a to its floor with $\mathtt{k}+1$ bits of precision.
(SIMPLIFY D) [FUNCTION] · src
Simplifies a dyadic by maximizing the absolute value of the exponent.
(SIMPLIFY-INTEGER N) [FUNCTION] · src
Finds the simplest dyadic given an integer.
Package COALTON-LIBRARY/MATH/ELEMENTARY
Classes
ELEMENTARY [CLASS] · src
(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] · src
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
EXPONENTIABLECREALEXPONENTIABLEBIG-FLOAT(EXPONENTIABLE :A) (RECIPROCABLE :A) ⇒ EXPONENTIABLE (HYPERDUAL:A)(NUM :A) (EXPONENTIABLE :A) (RECIPROCABLE :A) ⇒ EXPONENTIABLE (DUAL:A)ELEMENTARY :A ⇒ EXPONENTIABLE (COMPLEX:A)EXPONENTIABLEF64EXPONENTIABLEF32
POLAR [CLASS] · src
(COMPLEXCOMPONENT :A) (NUM :A) ⇒ POLAR :A
This type class includes ComplexComponent types that admit a magnitude and phase.
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:
RADICAL [CLASS] · src
RADICAL :A
Obeys:
(^ (sqrt x) 2) = x = (^^ (nth-root n x) n)
Methods:
NTH-ROOT :: (INTEGER→ :A → :A)SQRT :: (:A → :A)
Instances
RADICALCREALRADICALBIG-FLOAT(RADICAL :A) (RECIPROCABLE :A) (EXPONENTIABLE :A) ⇒ RADICAL (HYPERDUAL:A)(NUM :A) (RADICAL :A) (RECIPROCABLE :A) (EXPONENTIABLE :A) ⇒ RADICAL (DUAL:A)ELEMENTARY :A ⇒ RADICAL (COMPLEX:A)RADICALF64RADICALF32
TRIGONOMETRIC [CLASS] · src
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
TRIGONOMETRICCREALTRIGONOMETRICBIG-FLOAT(TRIGONOMETRIC :A) (RECIPROCABLE :A) (RADICAL :A) ⇒ TRIGONOMETRIC (HYPERDUAL:A)(NUM :A) (TRIGONOMETRIC :A) (RECIPROCABLE :A) (RADICAL :A) ⇒ TRIGONOMETRIC (DUAL:A)ELEMENTARY :A ⇒ TRIGONOMETRIC (COMPLEX:A)TRIGONOMETRICF64TRIGONOMETRICF32
Values
(ACOSH X) [FUNCTION] · src
∀ :A. ELEMENTARY :A ⇒ (:A → :A)
(ASINH X) [FUNCTION] · src
∀ :A. ELEMENTARY :A ⇒ (:A → :A)
(ATAN2 Y X) [FUNCTION] · src
∀ :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 point $(\mathtt{x},\mathtt{y})$.
(ATANH X) [FUNCTION] · src
∀ :A. ELEMENTARY :A ⇒ (:A → :A)
(CIS Z) [FUNCTION] · src
∀ :A. (TRIGONOMETRIC :A) (COMPLEXCOMPONENT :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] · src
∀ :A. ELEMENTARY :A ⇒ (:A → :A)
(MAGNITUDE Z) [FUNCTION] · src
∀ :A. (RADICAL :A) (COMPLEXCOMPONENT :A) ⇒ ((COMPLEX :A) → :A)
The magnitude of a complex number. For z = x + yi,
(magnitude z) = (sqrt (+ (^ x 2) (^ y 2)))
(SINCOS X) [FUNCTION] · src
∀ :A. TRIGONOMETRIC :A ⇒ (:A → (TUPLE :A :A))
Computes the sine and cosine of X.
(SINH X) [FUNCTION] · src
∀ :A. ELEMENTARY :A ⇒ (:A → :A)
(TANH X) [FUNCTION] · src
∀ :A. ELEMENTARY :A ⇒ (:A → :A)
Package COALTON-LIBRARY/MATH/FRACTION
Values
(DENOMINATOR Q) [FUNCTION] · src
The denominator of a fraction.
(MKFRACTION A B) [FUNCTION] · src
(INTEGER → INTEGER → FRACTION)
(NUMERATOR Q) [FUNCTION] · src
The numerator of a fraction.
Package COALTON-LIBRARY/MATH/HYPERDUAL
An implementation of hyperdual numbers for second-order and multivariate automatic differentiation.
——————————————————————————————————————————————–
For univariate differentiation of a function f at a point x, apply
f to (Hyperdual x 1 1 0). The result will be
(Hyperdual f(x) df/dx(x) df/dx(x) d²f/dx²(x)).
You may also use the convenience functions d-x and d-xx to compute
the first and second derivatives as (d-x f x) and (d-xx f x).
——————————————————————————————————————————————–
For multivariate differentiation of a function f at a point (x, y), an application of f to (Hyperdual x 1 0 0) and
(Hyperdual y 0 1 0) will result in
(Hyperdual f(x, y) ∂f/∂x(x, y) ∂f/∂y(x, y) ∂²f/∂x∂y(x, y)).
Second derivatives of a single argument xi of f are computed in
the same manner as the univariate case, except the values
(Hyperdual xj 0 0 0) are passed for the remaining arguments, j ≠ i.
You may also use the convenience functions partial-x, partial-y,
gradient, partial-xx, partial-xy, partial-yy, hessian, and
laplacian, to compute partials of bivariate functions.
——————————————————————————————————————————————–
The following list of identities describe the theory of hyperdual numbers.
:: given (∀i∀j((i ≠ j) → (εᵢεⱼ ≠ 0)) ∧ ∀i(εᵢ² = 0))
——————————————————————————————————————————————–
:: univariate identities
(1) f(a + bε₁ + cε₂ + dε₁ε₂) = f(a) + (bε₁+cε₂+dε₁ε₂)f’(a) + bcε₁ε₂f’’(a) = f(a) + bf’(a)ε₁ + cf’(a)ε₂ + [df’(a) + bcf’’(a)]ε₁ε₂
(2) f(x + ε₁ + ε₂) = f(x) + f’(x)ε₁ + f’(x)ε₂ + f’’(x)ε₁ε₂
:: multivariate identities
(3) f(a₁ + b₁ε₁ + c₁ε₂ + d₁ε₁ε₂, a₂ + b₂ε₁ + c₂ε₂ + d₂ε₁ε₂) = f(a₁, a₂) + (b₁ε₁ + c₁ε₂ + d₁ε₁ε₂)∂f/∂x(a₁, a₂) + b₁c₁ε₁ε₂∂²f/∂x²(a₁, a₂) + (b₂ε₁ + c₂ε₂ + d₂ε₁ε₂)∂f/∂y(a₁, a₂) + b₂c₂ε₁ε₂∂²f/∂y² + (b₁c₂ + b₂c₁)ε₁ε₂∂²f/∂x∂y(a₁, a₂) = f(a₁, a₂) + (b₁∂f/∂x(a₁, a₂) + b₂∂f/∂y(a₁, a₂))ε₁ + (c₁∂f/∂x(a₁, a₂) + c₂∂f/∂y(a₁, a₂))ε₂ + (d₁∂f/∂x(a₁, a₂) + d₂∂f/∂y(a₁, a₂) + b₁c₁∂²f/∂x²(a₁, a₂) + b₂c₂∂²f/∂x²(a₁, a₂) + (b₁c₂ + b₂c₁)∂²f/∂x∂y(a₁, a₂))ε₁ε₂
(4) f(x + ε₁ + ε₂, y) = f(x, y) + ∂f/∂x(x, y)ε₁ + ∂f/∂x(x, y)ε₂ + ∂²f/∂x²(x, y)ε₁ε₂
(5) f(x + ε₁, y + ε₂) = f(x, y) + ∂f/∂x(x, y)ε₁ + ∂f/∂y(x, y)ε₂ + ∂²f/∂x∂y(x, y)ε₁ε₂
(6) f(x, y + ε₁ + ε₂) = f(x, y) + ∂f/∂y(x, y)ε₁ + ∂f/∂y(x, y)ε₂ + ∂²f/∂y²(x, y)ε₁ε₂
:: equivalently
(1) (f (Hyperdual a b c d)) = (Hyperdual (f a) (* b (f’ a)) (* c (f’ a)) (+ (* d (f’ a)) (* (* b c) (f’’ a))))
(2) (f (Hyperdual x 1 1 0)) = (Hyperdual (f x) (f’ x) (f’ x) (f’’ x))
(3) (f (Hyperdual a1 b1 c1 d1) (Hyperdual a2 b2 c2 d2)) = (Hyperdual (f a1 a2) (+ (* b1 (∂f/∂x a1 a2)) (* b2 (∂f/∂y a1 a2))) (+ (* c1 (∂f/∂x a1 a2)) (* c2 (∂f/∂y a1 a2))) (+ (+ (* d1 (∂f/∂x a1 a2)) (* d2 (∂f/∂y a1 a2))) (+ (* (* b1 c1) (∂²f/∂x² a1 a2)) (* (* b2 c2) (∂²f/∂y² a1 a2))) (* (+ (* b1 c2) (* b2 c1)) (∂²f/∂x∂y a1 a2)))
(4) (f (Hyperdual x 1 1 0) (Hyperdual y 0 0 0)) = (Hyperdual (f x y) (∂f/∂x x y) (∂f/∂x x y) (∂²f/∂x² x y))
(5) (f (Hyperdual x 1 0 0) (Hyperdual y 0 1 0)) = (Hyperdual (f x y) (∂f/∂x x y) (∂f/∂y x y) (∂²f/∂x∂y x y))
(6) (f (Hyperdual x 0 0 0) (Hyperdual y 1 1 0)) = (Hyperdual (f x y) (∂f/∂x x y) (∂f/∂x x y) (∂²f/∂x² x y))
Structs
HYPERDUAL :A [STRUCT] · src
Representation of a hyperdual number in the form a + bε₁ + cε₂ + dε₁ε₂ where a, b, c, and d are real numbers and ε₁ and ε₂ satisfy εᵢ² = 0 and ε₁ε₂ != 0.
Note: Eq, and Ord and Hash only make use of the primal component.
Instances
(EXPONENTIABLE :A) (RECIPROCABLE :A) ⇒ EXPONENTIABLE (HYPERDUAL:A)(RADICAL :A) (RECIPROCABLE :A) (EXPONENTIABLE :A) ⇒ RADICAL (HYPERDUAL:A)(TRIGONOMETRIC :A) (RECIPROCABLE :A) (RADICAL :A) ⇒ TRIGONOMETRIC (HYPERDUAL:A)COMPLEXCOMPONENT :A ⇒ COMPLEXCOMPONENT (HYPERDUAL:A)EQ :A ⇒ EQ (HYPERDUAL:A)HASH :A ⇒ HASH (HYPERDUAL:A)NUM :A ⇒ INTO :A (HYPERDUAL:A)NUM :A ⇒ NUM (HYPERDUAL:A)ORD :A ⇒ ORD (HYPERDUAL:A)RECIPROCABLE :A ⇒ RECIPROCABLE (HYPERDUAL:A)RUNTIMEREPR (HYPERDUAL:A)
Values
(D-X F X) [FUNCTION] · src
∀ :A. NUM :A ⇒ (((HYPERDUAL :A) → (HYPERDUAL :A)) → :A → :A)
Compute f’(x).
(D-XX F X) [FUNCTION] · src
∀ :A. NUM :A ⇒ (((HYPERDUAL :A) → (HYPERDUAL :A)) → :A → :A)
Compute f’’(x).
(GRADIENT F X Y) [FUNCTION] · src
∀ :A. NUM :A ⇒ (((HYPERDUAL :A) → (HYPERDUAL :A) → (HYPERDUAL :A)) → :A → :A → (LIST :A))
Compute the gradient (∂f/∂x, ∂f/∂y) at the point (x, y).
(HESSIAN F X Y) [FUNCTION] · src
∀ :A. NUM :A ⇒ (((HYPERDUAL :A) → (HYPERDUAL :A) → (HYPERDUAL :A)) → :A → :A → (LIST :A))
Compute the flat Hessian (∂²f/∂x², ∂²f/∂x∂y, ∂²f/∂y∂x, ∂²f/∂y²) at the point (x, y).
(LAPLACIAN F X Y) [FUNCTION] · src
∀ :A. NUM :A ⇒ (((HYPERDUAL :A) → (HYPERDUAL :A) → (HYPERDUAL :A)) → :A → :A → :A)
Compute the Laplacian ∂²f/∂x² + ∂²f/∂y² at the point (x, y).
(PARTIAL-X F X Y) [FUNCTION] · src
∀ :A. NUM :A ⇒ (((HYPERDUAL :A) → (HYPERDUAL :A) → (HYPERDUAL :A)) → :A → :A → :A)
Compute ∂f/∂x(x, y).
(PARTIAL-XX F X Y) [FUNCTION] · src
∀ :A. NUM :A ⇒ (((HYPERDUAL :A) → (HYPERDUAL :A) → (HYPERDUAL :A)) → :A → :A → :A)
Compute ∂²f/∂x²(x, y).
(PARTIAL-XY F X Y) [FUNCTION] · src
∀ :A. NUM :A ⇒ (((HYPERDUAL :A) → (HYPERDUAL :A) → (HYPERDUAL :A)) → :A → :A → :A)
Compute ∂²f/∂x∂y(x, y).
(PARTIAL-Y F X Y) [FUNCTION] · src
∀ :A. NUM :A ⇒ (((HYPERDUAL :A) → (HYPERDUAL :A) → (HYPERDUAL :A)) → :A → :A → :A)
Compute ∂f/∂y(x, y).
(PARTIAL-YY F X Y) [FUNCTION] · src
∀ :A. NUM :A ⇒ (((HYPERDUAL :A) → (HYPERDUAL :A) → (HYPERDUAL :A)) → :A → :A → :A)
Compute ∂²f/∂y²(x, y).
Package COALTON-LIBRARY/MATH/INTEGRAL
Classes
INTEGRAL [CLASS] · src
(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] · src
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] · src
∀ :A. INTEGRAL :A ⇒ (:A → BOOLEAN)
Is N even?
(GCD A B) [FUNCTION] · src
∀ :A. (REMAINDER :A) (ORD :A) ⇒ (:A → :A → :A)
The greatest common divisor of A and B.
(ILOG B X) [FUNCTION] · src
∀ :A. INTEGRAL :A ⇒ (:A → :A → :A)
The floor of the logarithm with base B > 1 of X >= 1.
(INTEGRAL->NUM N) [FUNCTION] · src
∀ :A :B. (INTEGRAL :A) (NUM :B) ⇒ (:A → :B)
Converts any Integral N into any Num.
(ISQRT X) [FUNCTION] · src
∀ :A. INTEGRAL :A ⇒ (:A → :A)
The floor of the square root of N > 0.
(LCM A B) [FUNCTION] · src
∀ :A. (REMAINDER :A) (ORD :A) ⇒ (:A → :A → :A)
The least common multiple of A and B.
(LSH X N) [FUNCTION] · src
∀ :A :B. (INTEGRAL :B) (BITS :A) ⇒ (:A → :B → :A)
Left shift X by N
(ODD? N) [FUNCTION] · src
∀ :A. INTEGRAL :A ⇒ (:A → BOOLEAN)
Is N odd?
(RSH X N) [FUNCTION] · src
∀ :A :B. (INTEGRAL :B) (BITS :A) ⇒ (:A → :B → :A)
Right shift X by N
(^ BASE POWER) [FUNCTION] · src
∀ :A :B. (NUM :A) (INTEGRAL :B) ⇒ (:A → :B → :A)
Exponentiate BASE to a non-negative POWER.
(^^ BASE POWER) [FUNCTION] · src
∀ :A :B. (RECIPROCABLE :A) (INTEGRAL :B) ⇒ (:A → :B → :A)
Exponentiate BASE to a signed POWER.
Package COALTON-LIBRARY/MATH/REAL
Structs
QUANTIZATION :A [STRUCT] · src
Represents an integer quantization of :a.
Instances
RUNTIMEREPR (QUANTIZATION:A)
Classes
QUANTIZABLE [CLASS] · src
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] · src
(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] · src
(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] · src
Divide two integers and compute the ceiling of the quotient.
(EXACT/ A B) [FUNCTION] · src
(INTEGER → INTEGER → FRACTION)
Exactly divide two integers and produce a fraction.
(FLOOR/ A B) [FUNCTION] · src
Divide two integers and compute the floor of the quotient.
(FROMFRAC Q) [FUNCTION] · src
∀ :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] · src
Compute the quotient of integers as a double-precision float.
Note: This does not divide double-float arguments.
(QUANTIZE X) [FUNCTION] · src
∀ :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] · src
∀ :A. (QUANTIZABLE :A) (NUM :A) ⇒ (:A → INTEGER)
Return the nearest integer to X, with ties breaking towards even numbers.
(ROUND-HALF-DOWN X) [FUNCTION] · src
∀ :A. (QUANTIZABLE :A) (NUM :A) ⇒ (:A → INTEGER)
Return the nearest integer to X, with ties breaking toward positive infinity.
(ROUND-HALF-UP X) [FUNCTION] · src
∀ :A. (QUANTIZABLE :A) (NUM :A) ⇒ (:A → INTEGER)
Return the nearest integer to X, with ties breaking toward positive infinity.
(ROUND/ A B) [FUNCTION] · src
Divide two integers and round the quotient.
(SAFE/ X Y) [FUNCTION] · src
∀ :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] · src
∀ :A. QUANTIZABLE :A ⇒ (:A → INTEGER)
Returns the integer closest/equal to x that is within 0 and x.
Package COALTON-LIBRARY/MONAD/CLASSES
Classes
MONADENVIRONMENT [CLASS] · src
MONAD :A ⇒ MONADENVIRONMENT :B :A
A monad capable of a function in a computation environment.
Methods:
ASK :: (:A :B)
Retrieves the computation environment.LOCAL :: ((:B → :B) → (:A :C) → (:A :C))
Run a computation in a modified environment.ASKS :: ((:B → :D) → (:A :D))
Retrieve an aspect of the computation environment.
Instances
MONADENVIRONMENT :A :B ⇒ MONADENVIRONMENT :A (OPTIONALT:B)MONADENVIRONMENT :A :B ⇒ MONADENVIRONMENT :A ((RESULTT:C) :B)MONAD :A ⇒ MONADENVIRONMENT :B ((ENVT:B) :A)MONADENVIRONMENT :A (ENV:A)MONADENVIRONMENT :A :B ⇒ MONADENVIRONMENT :A ((STATET:C) :B)
MONADSTATE [CLASS] · src
MONAD :A ⇒ MONADSTATE :B :A
A monad capable of tracking state in a computation.
Methods:
GET :: (:A :B)
Retrieve the computation state.PUT :: (:B → (:AUNIT))
Set the state to a given value.MODIFY :: ((:B → :B) → (:AUNIT))
Modify the computation state, discarding the old state.
Instances
MONADSTATE :A :B ⇒ MONADSTATE :A (OPTIONALT:B)MONADSTATE :A :B ⇒ MONADSTATE :A ((RESULTT:C) :B)MONADSTATE :A :B ⇒ MONADSTATE :A ((ENVT:C) :B)MONAD :A ⇒ MONADSTATE :B ((STATET:B) :A)
Package COALTON-LIBRARY/MONAD/ENVIRONMENT
Types
ENV [TYPE] · src
(ENV (:A → :B))
A computation that runs inside an :env environment.
Instances
APPLICATIVE (ENV:A)FUNCTOR (ENV:A)MONAD (ENV:A)MONADENVIRONMENT :A (ENV:A)RUNTIMEREPR (ENV:A :B)
ENVT [TYPE] · src
(ENVT (:A → (:B :C)))
A monadic computation that runs inside an :env environment. Equivalent to Haskell’s ReaderT monad https://hackage.haskell.org/package/transformers-0.6.1.2/docs/Control-Monad-Trans-Reader.html
Instances
APPLICATIVE :A ⇒ APPLICATIVE ((ENVT:B) :A)FUNCTOR :A ⇒ FUNCTOR ((ENVT:B) :A)MONAD :A ⇒ MONAD ((ENVT:B) :A)MONAD :A ⇒ MONADENVIRONMENT :B ((ENVT:B) :A)MONADSTATE :A :B ⇒ MONADSTATE :A ((ENVT:C) :B)MONADTRANSFORMER (ENVT:A)RUNTIMEREPR (((ENVT:A) :B) :C)
Values
(ASKS-ENV FENV->A) [FUNCTION] · src
∀ :A :B. ((:A → :B) → (ENV :A :B))
Retrieve an aspect of the computation environment.
(ASKS-ENVT FENV->A) [FUNCTION] · src
∀ :A :B :C. APPLICATIVE :C ⇒ ((:A → :B) → (((ENVT :A) :C) :B))
Retrieve an aspect of the computation environment.
(LIFT-ENVT M) [FUNCTION] · src
∀ :A :B :C. ((:A :B) → (((ENVT :C) :A) :B))
(LOCAL-ENV FENV MENV) [FUNCTION] · src
∀ :A :B. ((:A → :A) → (ENV :A :B) → (ENV :A :B))
(LOCAL-ENVT FENV (ENVT FENV->A)) [FUNCTION] · src
∀ :A :B :C. ((:A → :A) → (((ENVT :A) :B) :C) → (((ENVT :A) :B) :C))
Run a computation in a modified environment.
(MAP-ENVT FMA->NB (ENVT FENV->MA)) [FUNCTION] · src
∀ :A :B :C :D :E. (((:A :B) → (:C :D)) → (((ENVT :E) :A) :B) → (((ENVT :E) :C) :D))
(RUN-ENV (ENV ENV-COMPUTATION) ENV) [FUNCTION] · src
∀ :A :B. ((ENV :A :B) → :A → :B)
Run a Env inside an environment.
(RUN-ENVT (ENVT FENV->VAL) ENV) [FUNCTION] · src
∀ :A :B :C. ((((ENVT :A) :B) :C) → :A → (:B :C))
Run a EnvT inside an environment.
ASK-ENV [VALUE] · src
∀ :A. (ENV :A :A)
Retrieve the computation environment.
ASK-ENVT [VALUE] · src
∀ :A :B. MONAD :B ⇒ (((ENVT :A) :B) :A)
Retrieve the computation environment.
Package COALTON-LIBRARY/MONAD/FREE
Types
FREE [TYPE] · src
(FREE (:A ((FREE:A) :B)))(VAL :C)
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)FUNCTOR :A ⇒ MONADFREE :A (FREE:A)RUNTIMEREPR ((FREE:A) :B)TRAVERSABLE :A ⇒ TRAVERSABLE (FREE:A)
Classes
MONADFREE [CLASS] · src
A free monad is a monad, :m, which is capable of ‘wrapping’
around functors, and then ‘unwrapping’ them later using >>=.
Methods:
WRAP :: ((:B (:A :C)) → (:A :C))
Instances
Values
(FOLDFREE NAT FR) [FUNCTION] · src
∀ :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] · src
∀ :A :B :C. (FUNCTOR :A) (MONADFREE :A :C) ⇒ ((:A :B) → (:C :B))
Lift a Functor into the Free Monad.
Package COALTON-LIBRARY/MONAD/FREET
Types
FREEF [TYPE] · src
(FREEF (:A :B))(VAL :C)
Instances
FUNCTOR :A ⇒ BIFUNCTOR (FREEF:A)FUNCTOR :A ⇒ FUNCTOR ((FREEF:A) :B)RUNTIMEREPR (((FREEF:A) :B) :C)TRAVERSABLE :A ⇒ TRAVERSABLE ((FREEF:A) :B)
FREET [TYPE] · src
Free :f :m :a gives you a Monad Transformer instance for any Functor :f and Monad :m.
Instances
(FUNCTOR :A) (FUNCTOR :B) ⇒ FUNCTOR ((FREET:A) :B)(FUNCTOR :A) (MONAD :B) ⇒ APPLICATIVE ((FREET:A) :B)(FUNCTOR :A) (MONAD :B) ⇒ MONAD ((FREET:A) :B)(FUNCTOR :A) (MONAD :B) ⇒ MONADFREE :A ((FREET:A) :B)(MONAD :A) (TRAVERSABLE :A) (TRAVERSABLE :B) ⇒ TRAVERSABLE ((FREET:B) :A)FUNCTOR :A ⇒ MONADTRANSFORMER (FREET:A)RUNTIMEREPR (((FREET:A) :B) :C)
Values
(FOLD-FREET F (FREET M)) [FUNCTION] · src
∀ :A :B :C :D. (MONADTRANSFORMER :D) (MONAD (:D :B)) (MONAD :B) ⇒ (((:A (((FREET :A) :B) :C)) → ((:D :B) (((FREET :A) :B) :C))) → (((FREET :A) :B) :C) → ((:D :B) :C))
(RUN-FREET (FREET M)) [FUNCTION] · src
∀ :A :B :C. ((((FREET :A) :B) :C) → (:B (((FREEF :A) :C) (((FREET :A) :B) :C))))
Package COALTON-LIBRARY/MONAD/IDENTITY
Types
IDENTITY [TYPE] · src
(IDENTITY :A)
A bare computation. Not useful on its own, but is useful for running Monad transformers in a bare context.
Instances
Values
(RUN-IDENTITY (IDENTITY A)) [FUNCTION] · src
∀ :A. ((IDENTITY :A) → :A)
Package COALTON-LIBRARY/MONAD/OPTIONALT
Types
OPTIONALT [TYPE] · src
(OPTIONALT (:A (OPTIONAL:B)))
A monadic computation that returns an Optional.
Instances
FUNCTOR :A ⇒ FUNCTOR (OPTIONALT:A)MONAD :A ⇒ ALTERNATIVE (OPTIONALT:A)MONAD :A ⇒ APPLICATIVE (OPTIONALT:A)MONAD :A ⇒ MONAD (OPTIONALT:A)MONADENVIRONMENT :A :B ⇒ MONADENVIRONMENT :A (OPTIONALT:B)MONADSTATE :A :B ⇒ MONADSTATE :A (OPTIONALT:B)MONADTRANSFORMEROPTIONALTRUNTIMEREPR ((OPTIONALT:A) :B)
Values
(MAP-OPTIONALT F (OPTIONALT M)) [FUNCTION] · src
∀ :A :B :C :D. (((:A (OPTIONAL :B)) → (:C (OPTIONAL :D))) → ((OPTIONALT :A) :B) → ((OPTIONALT :C) :D))
(RUN-OPTIONALT (OPTIONALT M)) [FUNCTION] · src
∀ :A :B. (((OPTIONALT :A) :B) → (:A (OPTIONAL :B)))
Package COALTON-LIBRARY/MONAD/RESULTT
Types
RESULTT [TYPE] · src
(RESULTT (:A (RESULT:B :C)))
A monadic computation that returns a Result.
Instances
FUNCTOR :A ⇒ FUNCTOR ((RESULTT:B) :A)MONAD :A ⇒ APPLICATIVE ((RESULTT:B) :A)MONAD :A ⇒ MONAD ((RESULTT:B) :A)MONADENVIRONMENT :A :B ⇒ MONADENVIRONMENT :A ((RESULTT:C) :B)MONADSTATE :A :B ⇒ MONADSTATE :A ((RESULTT:C) :B)MONADTRANSFORMER (RESULTT:A)RUNTIMEREPR (((RESULTT:A) :B) :C)
Values
(ERR-IFT PASSED FAILURE) [FUNCTION] · src
∀ :A :B. MONAD :B ⇒ (BOOLEAN → :A → (((RESULTT :A) :B) UNIT))
(MAP-ERRT FERR) [FUNCTION] · src
∀ :A :B :C :D. FUNCTOR :C ⇒ ((:A → :B) → (((RESULTT :A) :C) :D) → (((RESULTT :B) :C) :D))
(MAP-RESULTT F (RESULTT M)) [FUNCTION] · src
∀ :A :B :C :D :E :F. (((:A (RESULT :B :C)) → (:D (RESULT :E :F))) → (((RESULTT :B) :A) :C) → (((RESULTT :E) :D) :F))
(RUN-RESULTT (RESULTT M)) [FUNCTION] · src
∀ :A :B :C. ((((RESULTT :A) :B) :C) → (:B (RESULT :A :C)))
Package COALTON-LIBRARY/MONAD/STATE
Types
ST [TYPE] · src
(ST (:A → (TUPLE:A :B)))
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
(MODIFY FS->S) [FUNCTION] · src
∀ :A. ((:A → :A) → (ST :A UNIT))
Modify the state in a StatefulComputation, discarding the old state.
(MODIFY-GET FS->S) [FUNCTION] · src
∀ :A. ((:A → :A) → (ST :A :A))
Modify the state in a StatefulComputation, discarding the old state. Return the new state.
(MODIFY-SWAP FS->S) [FUNCTION] · src
∀ :A. ((:A → :A) → (ST :A :A))
Modify the state in a StatefulComputation, returning the old state.
(PUT STATE) [FUNCTION] · src
A StatefulComputation with state set to be the given state. The returned value is Unit.
(RUN SC) [FUNCTION] · src
∀ :A :B. ((ST :A :B) → :A → (TUPLE :A :B))
Runs a StatefulComputation to produce a final updated state and value given an initial state
(SWAP STATE) [FUNCTION] · src
∀ :A. (:A → (ST :A :A))
A StatefulComputation with state set to be the given state. The old state is returned.
GET [VALUE] · src
∀ :A. (ST :A :A)
A StatefulComputation which returns the current state as the value.
Package COALTON-LIBRARY/MONAD/STATET
Types
STATET [TYPE] · src
(STATET (:A → (:B (TUPLE:A :C))))
A monadic computation that tracks state of type :s.
Instances
APPLICATIVE :A ⇒ APPLICATIVE ((STATET:B) :A)FUNCTOR :A ⇒ FUNCTOR ((STATET:B) :A)MONAD :A ⇒ MONAD ((STATET:B) :A)MONAD :A ⇒ MONADSTATE :B ((STATET:B) :A)MONADENVIRONMENT :A :B ⇒ MONADENVIRONMENT :A ((STATET:C) :B)MONADTRANSFORMER (STATET:A)RUNTIMEREPR (((STATET:A) :B) :C)
Values
(LIFT-STATET M) [FUNCTION] · src
∀ :A :B :C. FUNCTOR :A ⇒ ((:A :B) → (((STATET :C) :A) :B))
Lift a stateless computation into a stateful context.
(MAP-STATET FMA->NB (STATET FS->MSA)) [FUNCTION] · src
∀ :A :B :C :D :E. (((:A (TUPLE :B :C)) → (:D (TUPLE :B :E))) → (((STATET :B) :A) :C) → (((STATET :B) :D) :E))
Map the return value, the final state, and the execution context.
(MODIFY-STATET FS->S) [FUNCTION] · src
∀ :A :B. APPLICATIVE :B ⇒ ((:A → :A) → (((STATET :A) :B) UNIT))
Modify the computation state, discarding the old state.
(PUT-STATET STATE) [FUNCTION] · src
∀ :A :B. APPLICATIVE :B ⇒ (:A → (((STATET :A) :B) UNIT))
A stateful computation with state set to the given state. The returned value is Unit.
(RUN-STATET (STATET FS->MSA) S) [FUNCTION] · src
∀ :A :B :C. APPLICATIVE :B ⇒ ((((STATET :A) :B) :C) → :A → (:B (TUPLE :A :C)))
GET-STATET [VALUE] · src
∀ :A :B. APPLICATIVE :B ⇒ (((STATET :A) :B) :A)
A stateful computation which returns the current state as the value.
Package COALTON-LIBRARY/OPTIONAL
Values
(FROM-SOME STR OPT) [FUNCTION] · src
∀ :A. (STRING → (OPTIONAL :A) → :A)
Get the value of OPT, erroring with the provided string if it is None.
(NONE? X) [FUNCTION] · src
∀ :A. ((OPTIONAL :A) → BOOLEAN)
Is X None?
(SOME? X) [FUNCTION] · src
∀ :A. ((OPTIONAL :A) → BOOLEAN)
Is X Some?
Package COALTON-LIBRARY/ORDMAP
Types
ORDMAP [TYPE] · src
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] · src
∀ :A :B :C. (ORD :B) (FOLDABLE :A) ⇒ ((:A (TUPLE :B :C)) → (ORDMAP :B :C))
Construct a OrdMap containing all the (key value) pairs in coll.
If coll contains duplicate keys, later values will overwrite earlier values.
(COLLECT! ITER) [FUNCTION] · src
∀ :A :B. ORD :A ⇒ ((ITERATOR (TUPLE :A :B)) → (ORDMAP :A :B))
Construct a OrdMap containing all the (key value) pairs in iter.
If iter contains duplicate keys, later values will overwrite earlier values.
(ENTRIES MP) [FUNCTION] · src
∀ :A :B. ((ORDMAP :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] · src
∀ :A :B. ORD :A ⇒ ((ORDMAP :A :B) → :A → :B → (OPTIONAL (ORDMAP :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] · src
∀ :A :B. ORD :A ⇒ ((ORDMAP :A :B) → :A → :B → (ORDMAP :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] · src
∀ :A :B. ((ORDMAP :A :B) → (ITERATOR :A))
Iterate over the keys in MP, sorted least-to-greatest.
(LOOKUP MP K) [FUNCTION] · src
∀ :A :B. ORD :A ⇒ ((ORDMAP :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] · src
∀ :A :B. ORD :A ⇒ ((ORDMAP :A :B) → (ORDMAP :A :B) → (ORDMAP :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 OrdMap cannot implement Monoid.
(REMOVE MP K) [FUNCTION] · src
∀ :A :B. ORD :A ⇒ ((ORDMAP :A :B) → :A → (OPTIONAL (ORDMAP :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] · src
∀ :A :B. ORD :A ⇒ ((ORDMAP :A :B) → :A → :B → (OPTIONAL (TUPLE (ORDMAP :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] · src
∀ :A :B. ORD :A ⇒ ((ORDMAP :A :B) → :A → :B → (TUPLE (ORDMAP :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] · src
∀ :A :B. ORD :B ⇒ ((:A → :A) → (ORDMAP :B :A) → :B → (OPTIONAL (ORDMAP :B :A)))
Apply FUNC to the value corresponding to KEY in MP, returning a new `OrdMap’ which maps KEY to the result of the function.
(VALUES MP) [FUNCTION] · src
∀ :A :B. ((ORDMAP :A :B) → (ITERATOR :B))
Iterate over the values in MP, sorted by their corresponding keys in least-to-greatest order.
EMPTY [VALUE] · src
∀ :A :B. (ORDMAP :A :B)
A OrdMap containing no mappings.
Package COALTON-LIBRARY/ORDTREE
Types
TREE [TYPE] · src
EMPTY- exported; an empty tree. considered black for the purpose of the invariants.
A red-black balanced binary tree, sorted by <=> and unique by ==.
Instances
Values
(COLLECT! ITER) [FUNCTION] · src
∀ :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] · src
∀ :A. ((TREE :A) → (ITERATOR :A))
Iterate the elements of a tree, starting with the greatest by `<=>’ and ending with the least.
(INCREASING-ORDER) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :A. ORD :A ⇒ ((TREE :A) → :A → (OPTIONAL :A))
If HAYSTACK contains an element == to NEEDLE, return it.
(MERGE A B) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :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.
Macros
MAKE (&REST ELEMENTS) [MACRO]
Construct a tree containing the elements.
e.g. (tree:make 5 6 1 8 9) returns a tree containing 1, 5, 6, 8, 9.
Package COALTON-LIBRARY/QUEUE
Types
QUEUE [TYPE] · src
Unbounded FIFO queue implemented with a linked list.
Instances
Values
(APPEND Q1 Q2) [FUNCTION] · src
∀ :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] · src
Clear all elements from q.
(COPY Q) [FUNCTION] · src
∀ :A. ((QUEUE :A) → (QUEUE :A))
Return a new queue containing the same elements as q.
(EMPTY? Q) [FUNCTION] · src
Is q empty?
(EXTEND! Q ITER) [FUNCTION] · src
∀ :A :B. INTOITERATOR :B :A ⇒ ((QUEUE :A) → :B → UNIT)
Push every element in iter to the end of q.
(INDEX INDEX Q) [FUNCTION] · src
∀ :A. (UFIX → (QUEUE :A) → (OPTIONAL :A))
Return the indexth element of q.
(INDEX-UNSAFE INDEX Q) [FUNCTION] · src
∀ :A. (UFIX → (QUEUE :A) → :A)
Return the indexth element of q without checking if the element exists.
(ITEMS! Q) [FUNCTION] · src
∀ :A. ((QUEUE :A) → (ITERATOR :A))
Returns an interator over the items of q, removing items as they are returned.
(LENGTH Q) [FUNCTION] · src
Returns the length of q.
(NEW _) [FUNCTION] · src
Create a new empty queue.
(PEEK Q) [FUNCTION] · src
∀ :A. ((QUEUE :A) → (OPTIONAL :A))
Peek at the first item of q.
(PEEK-UNSAFE Q) [FUNCTION] · src
∀ :A. ((QUEUE :A) → :A)
Peek at the first item of q without checking if the queue is empty.
(POP! Q) [FUNCTION] · src
∀ :A. ((QUEUE :A) → (OPTIONAL :A))
Remove and return the first item of q.
(POP-UNSAFE! Q) [FUNCTION] · src
∀ :A. ((QUEUE :A) → :A)
Remove and return the first item of q without checking if the queue is empty.
(PUSH! ITEM Q) [FUNCTION] · src
∀ :A. (:A → (QUEUE :A) → UNIT)
Push item onto the end of q.
Package COALTON-LIBRARY/RANDOMACCESS
Classes
RANDOMACCESS [CLASS] · src
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→ :B → :A)MAKE-UNINITIALIZED :: (UFIX→ :A)LENGTH :: (:A →UFIX)READABLE? :: (:A →BOOLEAN)WRITABLE? :: (:A →BOOLEAN)UNSAFE-AREF :: (:A →UFIX→ :B)UNSAFE-SET! :: (:A →UFIX→ :B →UNIT)
Instances
RANDOMACCESS (VECTOR:A) :ARUNTIMEREPR :A ⇒ RANDOMACCESS (LISPARRAY:A) :A
Values
(AREF STORAGE INDEX) [FUNCTION] · src
∀ :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.
(ROTATE! STORAGE INDEX1 INDEX2) [FUNCTION] · src
∀ :A :B. RANDOMACCESS :B :A ⇒ (:B → UFIX → UFIX → (OPTIONAL UNIT))
Rotate the elements at indices index1 and index2 of the random-access storage storage. Return None if the indices are out-of-bounds or if reading from or writing to storage is not permitted.
(SET! STORAGE INDEX VALUE) [FUNCTION] · src
∀ :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.
(UNSAFE-ROTATE! STORAGE INDEX1 INDEX2) [FUNCTION] · src
∀ :A :B. RANDOMACCESS :B :A ⇒ (:B → UFIX → UFIX → UNIT)
Rotate the elements at indices index1 and index2 of the random-access storage storage.
Package COALTON-LIBRARY/RESULT
Values
(ERR-IF FAILED? FAILURE) [FUNCTION] · src
∀ :A. (BOOLEAN → :A → (RESULT :A UNIT))
Fail with FAILURE value if FAILED? is True.
(ERR? X) [FUNCTION] · src
∀ :A :B. ((RESULT :A :B) → BOOLEAN)
Returns TRUE if X is ERR
(FLATTEN X) [FUNCTION] · src
∀ :A. ((RESULT :A :A) → :A)
(MAP-ERR F X) [FUNCTION] · src
∀ :A :B :C. ((:A → :B) → (RESULT :A :C) → (RESULT :B :C))
Map over the ERR case
(OK-OR-ERROR RES) [FUNCTION] · src
∀ :A :B. SIGNALABLE :A ⇒ ((RESULT :A :B) → :B)
(OK? X) [FUNCTION] · src
∀ :A :B. ((RESULT :A :B) → BOOLEAN)
Returns TRUE if X is OK
(OPT->RESULT FAILURE OPT) [FUNCTION] · src
∀ :A :B. (:A → (OPTIONAL :B) → (RESULT :A :B))
Convert OPT to a Result, using FAILURE value if None.
Package COALTON-LIBRARY/SEQ
Types
SEQ [TYPE] · src
Instances
(FOLDABLE :A) (RUNTIMEREPR :B) ⇒ INTO (:A :B) (SEQ:B)EQ :A ⇒ EQ (SEQ:A)FUNCTORSEQINTO (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] · src
∀ :A. RUNTIMEREPR :A ⇒ ((SEQ :A) → (SEQ :A) → (SEQ :A))
Concatenate two Seqs
(EMPTY? SEQ) [FUNCTION] · src
(GET SEQ IDX) [FUNCTION] · src
∀ :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] · src
∀ :A. RUNTIMEREPR :A ⇒ (UNIT → (SEQ :A))
Create a new empty Seq.
(POP SEQ) [FUNCTION] · src
∀ :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] · src
∀ :A. ((SEQ :A) → :A → (SEQ :A))
Push a onto the end of seq, returning a new Seq instance.
(PUT SEQ IDX A) [FUNCTION] · src
∀ :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] · src
Return the number of elements in the seq.
Macros
MAKE (&REST ELEMS) [MACRO]
Create a new Seq containing elems.
Package COALTON-LIBRARY/SLICE
Types
SLICE [TYPE] · src
Instances
Values
(INDEX IDX S) [FUNCTION] · src
∀ :A. (UFIX → (SLICE :A) → (OPTIONAL :A))
Lookup the element at index in s.
(INDEX-UNSAFE IDX S) [FUNCTION] · src
∀ :A. (UFIX → (SLICE :A) → :A)
Lookup the element at index in s without bounds checking.
(ITER-CHUNKED SIZE S) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
Returns the length of s.
(NEW START LEN V) [FUNCTION] · src
∀ :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] · src
∀ :A. (UFIX → :A → (SLICE :A) → UNIT)
Set the element at index idx in s to item.
Package COALTON-LIBRARY/STRING
Values
(CHARS STR) [FUNCTION] · src
Returns an iterator over the characters in str.
(CONCAT STR1 STR2) [FUNCTION] · src
Concatenate STR1 and STR2 together, returning a new string.
(DOWNCASE STR) [FUNCTION] · src
Returns a new string with lowercase characters.
(LENGTH STR) [FUNCTION] · src
The length of a string STR.
(PARSE-INT STR) [FUNCTION] · src
Parse the integer in string str.
(REF STR IDX) [FUNCTION] · src
(STRING → UFIX → (OPTIONAL CHAR))
Return the idxth character of str.
(REF-UNCHECKED STR IDX) [FUNCTION] · src
Return the idxth character of str. This function is partial.
(REVERSE S) [FUNCTION] · src
Reverse a string.
(SPLIT N STR) [FUNCTION] · src
(UFIX → STRING → (TUPLE STRING STRING))
Splits a string into a head and tail at the nth index.
(STRIP-PREFIX PREFIX STR) [FUNCTION] · src
(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] · src
(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] · src
(STRING → UFIX → UFIX → STRING)
Compute a substring of a string bounded by given indices.
(SUBSTRING-INDEX SMALL BIG) [FUNCTION] · src
(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] · src
Return true if the first argument appears as a substring within the second argument.
(UPCASE STR) [FUNCTION] · src
Returns a new string with uppercase characters.
Package COALTON-LIBRARY/SYMBOL
An interface to Common Lisp symbols.
Types
SYMBOL [TYPE] · src
A Common Lisp symbol.
Values
(GENSYM _) [FUNCTION] · src
Make an uninterned symbol as by cl:gensym.
(KEYWORD? S) [FUNCTION] · src
Is the symbol s a Common Lisp keyword?
(MAKE-KEYWORD S) [FUNCTION] · src
Find or make a keyword named s.
WARNING: This function interns a new symbol. It will not get garbage collected. Use with caution.
(MAKE-SYMBOL S) [FUNCTION] · src
Make an uninterned symbol with the name s.
(SYMBOL-NAME S) [FUNCTION] · src
Return the name of the symbol s.
(UNINTERNED? S) [FUNCTION] · src
Is the symbol s uninterned?
Package COALTON-LIBRARY/SYSTEM
Types
LISPCONDITION [TYPE] · src
Condition for lisp error handling. Uses cl:condition.
Instances
Structs
METEREDRESULT :A [STRUCT] · src
Function output with space and timing metedata.
Instances
RUNTIMEREPR (METEREDRESULT:A)
Values
(ADD-FEATURE FEAT) [FUNCTION] · src
Adds a feature feat to cl:*features*.
(ARCHITECTURE _) [FUNCTION] · src
The system’s architecture (stored at compile time).
(ARGV0 _) [FUNCTION] · src
The first command line argument (stored at compile time).
(CMD-ARGS _) [FUNCTION] · src
The current command line arguments (stored at compile time).
(FEATURES _) [FUNCTION] · src
Returns a list of active features, from cl:*features*.
(GC _) [FUNCTION] · src
Perform a full garbage collection.
(GET-REAL-TIME _) [FUNCTION] · src
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] · src
Gets the value of the environmental variable var, errors if var doesn’t exist.
(HOSTNAME _) [FUNCTION] · src
Returns the system’s hostname. This is a function because the hostname can be redefined.
(IMPLEMENTATION _) [FUNCTION] · src
The lisp implementation (stored at compile time).
(LISP-VERSION _) [FUNCTION] · src
The lisp implementation version (stored at compile time).
(MONOTONIC-BYTES-CONSED _) [FUNCTION] · src
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] · src
The system’s operating system (stored at compile time).
(SETENV! VAR VAL) [FUNCTION] · src
Sets an environment variable var to string val, only if var already exists.
(SLEEP N) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
∀ :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] · src
Converts internal time units into an integer number of rounded microseconds.
(TIME-UNITS->SECONDS T) [FUNCTION] · src
Converts internal time units into Fraction seconds.
INTERNAL-TIME-UNITS-PER-SECOND [VALUE] · src
The number of internal time units per second. This is implementation specific.
Package COALTON-LIBRARY/TUPLE
Structs
TUPLE3 :A :B :C [STRUCT] · src
FIRST :: :ASECOND :: :BTHIRD :: :C
Instances
TUPLE4 :A :B :C :D [STRUCT] · src
FIRST :: :ASECOND :: :BTHIRD :: :CFOURTH :: :D
Instances
TUPLE5 :A :B :C :D :E [STRUCT] · src
FIRST :: :ASECOND :: :BTHIRD :: :CFOURTH :: :DFIFTH :: :E
Instances
Values
(FST (TUPLE A _)) [FUNCTION] · src
∀ :A :B. ((TUPLE :A :B) → :A)
Get the first element of a tuple.
(SND (TUPLE _ B)) [FUNCTION] · src
∀ :A :B. ((TUPLE :A :B) → :B)
Get the second element of a tuple.
Package COALTON-LIBRARY/TYPES
Types
LISPTYPE [TYPE] · src
The runtime representation of a Coalton type as a lisp type.
Instances
PROXY [TYPE] · src
PROXY
Proxy holds no data, but has a phantom type parameter.
Instances
RUNTIMEREPR (PROXY:A)
Classes
RUNTIMEREPR [CLASS] · src
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
RUNTIMEREPRCREALRUNTIMEREPRBIG-FLOATRUNTIMEREPRROUNDINGMODERUNTIMEREPRSTREAMOPTIONSRUNTIMEREPRIFEXISTSRUNTIMEREPR (FILESTREAM:A)RUNTIMEREPRFILEERRORRUNTIMEREPRPATHNAMERUNTIMEREPRLISPCONDITIONRUNTIMEREPR (METEREDRESULT:A)RUNTIMEREPR (SEQ:A)RUNTIMEREPR (ORDMAP:A :B)RUNTIMEREPR (MAPPAIR:A :B)RUNTIMEREPR (ITERATORSTACKNODE:A)RUNTIMEREPR (TREE:A)RUNTIMEREPRCOLORRUNTIMEREPR (((FREET:A) :B) :C)RUNTIMEREPR (((FREEF:A) :B) :C)RUNTIMEREPR ((FREE:A) :B)RUNTIMEREPR ((OPTIONALT:A) :B)RUNTIMEREPR (((RESULTT:A) :B) :C)RUNTIMEREPR (((ENVT:A) :B) :C)RUNTIMEREPR (ENV:A :B)RUNTIMEREPR (((STATET:A) :B) :C)RUNTIMEREPR (ST:A :B)RUNTIMEREPR (IDENTITY:A)RUNTIMEREPR (QUEUE:A)RUNTIMEREPR (HASHMAP:A :B)RUNTIMEREPR (HMNODE:A :B)RUNTIMEREPR (HMENTRY:A :B)RUNTIMEREPR (HASHTABLE:A :B)RUNTIMEREPR (SLICE:A)RUNTIMEREPR (VECTOR:A)RUNTIMEREPR :A ⇒ RUNTIMEREPR (LISPARRAY:A)RUNTIMEREPRRANGESTATUSRUNTIMEREPR (ITERATOR:A)RUNTIMEREPR (TUPLE5:A :B :C :D :E)RUNTIMEREPR (TUPLE4:A :B :C :D)RUNTIMEREPR (TUPLE3:A :B :C)RUNTIMEREPR (CELL:A)RUNTIMEREPR (HYPERDUAL:A)RUNTIMEREPR (DUAL:A)RUNTIMEREPRDYADICRUNTIMEREPR :A ⇒ RUNTIMEREPR (COMPLEX:A)RUNTIMEREPR (QUANTIZATION:A)RUNTIMEREPRSYMBOLRUNTIMEREPR (TUPLE:A :B)RUNTIMEREPRORDRUNTIMEREPRHASHRUNTIMEREPR (RESULT:A :B)RUNTIMEREPRUFIXRUNTIMEREPRIFIXRUNTIMEREPRI64RUNTIMEREPRI32RUNTIMEREPRI16RUNTIMEREPRI8RUNTIMEREPRU64RUNTIMEREPRU32RUNTIMEREPRU16RUNTIMEREPRU8RUNTIMEREPRBITRUNTIMEREPRVOIDRUNTIMEREPR (PROXY:A)RUNTIMEREPRLISPTYPERUNTIMEREPR (OPTIONAL:A)RUNTIMEREPR (LIST:A)RUNTIMEREPR (:A → :B)RUNTIMEREPRFRACTIONRUNTIMEREPRSTRINGRUNTIMEREPRF64RUNTIMEREPRF32RUNTIMEREPRINTEGERRUNTIMEREPRCHARRUNTIMEREPRBOOLEAN
Values
(AS-PROXY-OF X _) [FUNCTION] · src
∀ :A. (:A → (PROXY :A) → :A)
Returns the parameter, forcing the proxy to have the same type as the parameter.
(PROXY-INNER _) [FUNCTION] · src
∀ :A :B. ((PROXY (:A :B)) → (PROXY :B))
(PROXY-OF _) [FUNCTION] · src
∀ :A. (:A → (PROXY :A))
Returns a Proxy containing the type of the parameter.
(RUNTIME-REPR-OF X) [FUNCTION] · src
∀ :A. RUNTIMEREPR :A ⇒ (:A → LISPTYPE)
Returns the runtime representation of the type of the given value.
Package COALTON-LIBRARY/VECTOR
Types
VECTOR [TYPE] · src
Instances
DEFAULT (VECTOR:A)EQ :A ⇒ EQ (VECTOR:A)FOLDABLEVECTORFROMITERATOR (VECTOR:A) :AFUNCTORVECTORINTO (LIST:A) (VECTOR:A)INTO (SEQ:A) (VECTOR:A)INTO (SLICE:A) (VECTOR:A)INTO (VECTOR:A) (LIST:A)INTO (VECTOR:A) (SLICE:A)INTO (VECTORCHAR)STRINGINTOSTRING(VECTORCHAR)INTOITERATOR (VECTOR:A) :AISO (SLICE:A) (VECTOR:A)ISO (VECTOR:A) (LIST:A)MONOID (VECTOR:A)RANDOMACCESS (VECTOR:A) :ARUNTIMEREPR (VECTOR:A)SEMIGROUP (VECTOR:A)SLICEABLE (VECTOR:A)
Values
(APPEND V1 V2) [FUNCTION] · src
∀ :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] · src
Returns the number of elements that v can store without resizing.
(CLEAR! V) [FUNCTION] · src
Set the capacity of v to 0.
(COPY V) [FUNCTION] · src
∀ :A. ((VECTOR :A) → (VECTOR :A))
Return a new vector containing the same elements as v.
(EMPTY? V) [FUNCTION] · src
Is v empty?
(EXTEND! VEC ITER) [FUNCTION] · src
∀ :A :B. INTOITERATOR :B :A ⇒ ((VECTOR :A) → :B → UNIT)
Push every element in iter to the end of vec.
(FIND-ELEM E V) [FUNCTION] · src
∀ :A. EQ :A ⇒ (:A → (VECTOR :A) → (OPTIONAL UFIX))
Find the index of element e in v.
(HEAD V) [FUNCTION] · src
∀ :A. ((VECTOR :A) → (OPTIONAL :A))
Return the first item of v.
(HEAD-UNSAFE V) [FUNCTION] · src
∀ :A. ((VECTOR :A) → :A)
Return the first item of v without first checking if v is empty.
(INDEX INDEX V) [FUNCTION] · src
∀ :A. (UFIX → (VECTOR :A) → (OPTIONAL :A))
Return the indexth element of v.
(INDEX-UNSAFE IDX V) [FUNCTION] · src
∀ :A. (UFIX → (VECTOR :A) → :A)
Return the idxth element of v without checking if the element exists.
(LAST V) [FUNCTION] · src
∀ :A. ((VECTOR :A) → (OPTIONAL :A))
Return the last element of v.
(LAST-UNSAFE V) [FUNCTION] · src
∀ :A. ((VECTOR :A) → :A)
Return the last element of v without first checking if v is empty.
(LENGTH V) [FUNCTION] · src
Returns the length of v.
(NEW _) [FUNCTION] · src
Create a new empty vector
(POP! V) [FUNCTION] · src
∀ :A. ((VECTOR :A) → (OPTIONAL :A))
Remove and return the last item of v.
(POP-UNSAFE! V) [FUNCTION] · src
∀ :A. ((VECTOR :A) → :A)
Remove and return the last item of v without checking if the vector is empty.
(PUSH! ITEM V) [FUNCTION] · src
∀ :A. (:A → (VECTOR :A) → UFIX)
Append item to v and resize v if necessary, returning the index of the new item.
(RESECT! V START END) [FUNCTION] · src
∀ :A. ((VECTOR :A) → UFIX → UFIX → UNIT)
Destructively kills a subsequence in a vector bounded by given indices.
start index is inclusive and end index is exclusive.
(REVERSE V) [FUNCTION] · src
∀ :A. ((VECTOR :A) → (VECTOR :A))
Returns a fresh vector with the elements of vector v in reverse order. The original vector isn’t modified.
(REVERSE! V) [FUNCTION] · src
∀ :A. ((VECTOR :A) → (VECTOR :A))
Returns a vector with the elements of vector v in reverse order. The original vector may be destroyed to produce the result.
(SET! IDX ITEM V) [FUNCTION] · src
∀ :A. (UFIX → :A → (VECTOR :A) → UNIT)
Set the idxth 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] · src
∀ :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] · src
∀ :A. (:A → (VECTOR :A))
Create a new vector with a single element equal to x
(SINGLETON? V) [FUNCTION] · src
Is v a singleton?
(SORT! V) [FUNCTION] · src
∀ :A. ORD :A ⇒ ((VECTOR :A) → UNIT)
Sort a vector in-place in ascending order.
(SORT-BY! F V) [FUNCTION] · src
∀ :A. ((:A → :A → BOOLEAN) → (VECTOR :A) → UNIT)
Sort a vector in-place with predicate function f.
(SUBSEQ V START END) [FUNCTION] · src
∀ :A. ((VECTOR :A) → UFIX → UFIX → (VECTOR :A))
Compute a subseq of a vector bounded by given indices.
start index is inclusive and end index is exclusive.
(SWAP-REMOVE! IDX VEC) [FUNCTION] · src
∀ :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] · src
∀ :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] · src
Create a new vector with n elements preallocated.
(WITH-INITIAL-ELEMENT N X) [FUNCTION] · src
∀ :A. (UFIX → :A → (VECTOR :A))
Create a new vector with n elements equal to x.
Macros
MAKE (&REST ELEMENTS) [MACRO]
Construct a `Vector’ containing the ELEMENTS, in the order listed.