Skip to content

Commit 7479591

Browse files
YarinHeffesstylewarning
authored andcommitted
remove nested coalton forms
1 parent 7593b05 commit 7479591

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Diff for: library/math/integral.lisp

+8-6
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,10 @@ are floored and truncated division, respectively."
191191
(lisp ,type (a n) (cl:rem a n)))
192192
(inline)
193193
(define (quotRem a n)
194-
(lisp (Tuple ,type ,type) (a n)
195-
(cl:multiple-value-bind (q r) (cl:truncate a n)
196-
(Tuple (coalton (the ,type (fromInt (lisp Integer () q)))) r))))
194+
(match (lisp (Tuple Integer ,type) (a n)
195+
(cl:multiple-value-call 'Tuple (cl:truncate a n)))
196+
((Tuple q r)
197+
(Tuple (fromInt q) r))))
197198
(inline)
198199
(define (div a n)
199200
(fromInt (lisp Integer (a n) (cl:floor a n))))
@@ -202,9 +203,10 @@ are floored and truncated division, respectively."
202203
(lisp ,type (a n) (cl:mod a n)))
203204
(inline)
204205
(define (divMod a n)
205-
(lisp (Tuple ,type ,type) (a n)
206-
(cl:multiple-value-bind (d m) (cl:floor a n)
207-
(Tuple (coalton (the ,type (fromInt (lisp Integer () d)))) m)))))))
206+
(match (lisp (Tuple Integer ,type) (a n)
207+
(cl:multiple-value-call 'Tuple (cl:floor a n)))
208+
((Tuple d m)
209+
(Tuple (fromInt d) m)))))))
208210

209211
(cl:defmacro %define-integral-native (type signed)
210212
(cl:let ((even? (cl:intern (cl:concatenate 'cl:string (cl:symbol-name type) "-EVEN?")))

0 commit comments

Comments
 (0)