Skip to content

Commit

Permalink
Move math package to math directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Izaakwltn authored and stylewarning committed Oct 14, 2024
1 parent 194c079 commit d0156b5
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 29 deletions.
3 changes: 2 additions & 1 deletion coalton.asd
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
(:file "complex")
(:file "elementary")
(:file "dyadic")
(:file "dual")))
(:file "dual")
(:file "package")))
(:file "randomaccess")
(:file "cell")
(:file "tuple")
Expand Down
4 changes: 2 additions & 2 deletions library/big-float/impl-default.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@
((BFNegInf) (error "Cannot rationalize -Inf"))
((BFNaN) (error "Cannot rationalize NaN"))))
(define (best-approx x)
(coalton-library/math/real::rational-approx (get-precision) x)))
(real-approx (get-precision) x)))

(define-instance (Quantizable Big-Float)
(define (proper x)
Expand Down Expand Up @@ -434,7 +434,7 @@
((BFInf) 0)
(_ BFNaN))))

(coalton-library/math/complex::%define-standard-complex-instances Big-Float)
(complex::%define-standard-complex-instances Big-Float)

(coalton-toplevel
;; SeriesSplit/SeriesResult could be extended to any ring (e.g. polynomials)
Expand Down
4 changes: 2 additions & 2 deletions library/big-float/impl-sbcl.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@

(define-instance (Real Big-Float)
(define (real-approx prec x)
(coalton-library/math/real::rational-approx prec x)))
(real-approx prec x)))

(define-instance (Rational Big-Float)
(define (to-fraction x)
Expand All @@ -269,7 +269,7 @@
(/ (fromInt a) (fromInt b))
(into (exact/ a b))))))

(coalton-library/math/complex::%define-standard-complex-instances Big-Float)
(complex::%define-standard-complex-instances Big-Float)

(coalton-toplevel

Expand Down
4 changes: 2 additions & 2 deletions library/big-float/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
(:use #:coalton
#:coalton-library/classes
#:coalton-library/functions
#:coalton-library/math
#:coalton-library/math/integral)
#:coalton-library/math)
(:import-from #:coalton-library/math/dyadic #:Dyadic)
(:local-nicknames
(#:dyadic #:coalton-library/math/dyadic)
(#:complex #:coalton-library/math/complex)
(#:bits #:coalton-library/bits))
(:export
#:RoundingMode
Expand Down
6 changes: 3 additions & 3 deletions library/list.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
(:local-nicknames
(#:cell #:coalton-library/cell)
(#:iter #:coalton-library/iterator)
(#:arith #:coalton-library/math/arith))
(#:math #:coalton-library/math))
(:export
#:head
#:tail
Expand Down Expand Up @@ -250,10 +250,10 @@
"Returns the nth-cdr of a list."
(cond ((null? l)
Nil)
((arith:zero? n)
((math:zero? n)
l)
(True
(nth-cdr (arith:1- n) (cdr l)))))
(nth-cdr (math:1- n) (cdr l)))))

(declare elemIndex (Eq :a => :a -> List :a -> Optional UFix))
(define (elemIndex x xs)
Expand Down
15 changes: 15 additions & 0 deletions library/math/package.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(uiop:define-package #:coalton-library/math
(:use-reexport
#:coalton-library/math/arith
#:coalton-library/math/num
#:coalton-library/math/bounded
#:coalton-library/math/conversions
#:coalton-library/math/fraction
#:coalton-library/math/integral
#:coalton-library/math/real
#:coalton-library/math/complex
#:coalton-library/math/elementary
#:coalton-library/math/dual))

#+sb-package-locks
(sb-ext:lock-package "COALTON-LIBRARY/MATH")
16 changes: 0 additions & 16 deletions library/prelude.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@
;;;;
;;;; Collections of packages

(uiop:define-package #:coalton-library/math
(:use-reexport
#:coalton-library/math/arith
#:coalton-library/math/num
#:coalton-library/math/bounded
#:coalton-library/math/conversions
#:coalton-library/math/fraction
#:coalton-library/math/integral
#:coalton-library/math/real
#:coalton-library/math/complex
#:coalton-library/math/elementary
#:coalton-library/math/dual))

#+sb-package-locks
(sb-ext:lock-package "COALTON-LIBRARY/MATH")

(uiop:define-package #:coalton-prelude
(:use-reexport
#:coalton-library/classes
Expand Down
2 changes: 1 addition & 1 deletion library/seq.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#:coalton-library/classes)
(:local-nicknames
(#:types #:coalton-library/types)
(#:math #:coalton-library/math/integral)
(#:math #:coalton-library/math)
(#:optional #:coalton-library/optional)
(#:cell #:coalton-library/cell)
(#:vector #:coalton-library/vector)
Expand Down
3 changes: 1 addition & 2 deletions library/slice.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
#:coalton-library/builtin
#:coalton-library/functions
#:coalton-library/classes
#:coalton-library/math/arith
#:coalton-library/math/integral)
#:coalton-library/math)
(:local-nicknames
(#:types #:coalton-library/types)
(#:cell #:coalton-library/cell)
Expand Down

0 comments on commit d0156b5

Please sign in to comment.