Skip to content

Commit

Permalink
Change Quantization from type to struct; doc upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Izaakwltn committed Oct 16, 2024
1 parent 60d3e81 commit 2ded512
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions library/math/real.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,18 @@ Furthermore, `best-approx` returns the simplest fraction, and both functions may
(%define-native-rationals Double-Float)

(coalton-toplevel
(define-type (Quantization :a)
"Represents an integer quantization of `:a`.
The fields are defined as follows:
1. A value of type `:a`.
2. The greatest integer less than or equal to a particular value.
3. The remainder of this as a value of type `:a`.
4. The least integer greater than or equal to a particular value.
5. The remainder of this as a value of type `:a`.
"
(Quantization :a Integer :a Integer :a))
(define-struct (Quantization :a)
"Represents an integer quantization of `:a`."
(value "A value of type `:a`."
:a)
(floor "The greatest integer less than or equal to a particular value."
Integer)
(floor-rem "The floor remainder as type `:a`."
:a)
(ceiling "The least integer greater than or equal to a particular value."
Integer)
(ceiling-rem "The ceiling remainder as type `:a`."
:a))

(declare quantize (Real :a => (:a -> (Quantization :a))))
(define (quantize x)
Expand Down

0 comments on commit 2ded512

Please sign in to comment.