<commit_before>(cl:in-package #:sicl-arithmetic)

;; ;;; addition
;; (defun binary-+ (x y)
;;   (check-type x number "a number")
;;   (check-type y number "a number")
;;   (typecase x
;;     (fixnum (typecase y
;; 	      (fixnum (fixnum-fixnum-+ x y))
;; 	      (bignum (fixnum-bignum-+ x y))
;; 	      (rational (fixnum-rational-+ x y))
;; 	      (float (fixnum-float-+ x y))))
;;     (bignum (typecase y
;; 	      (fixnum (bignum-fixnum-+ x y))
;; 	      (bignum (bignum-bignum-+ x y))
;; 	      (rational (bignum-rational-+ x y))
;; 	      (float (bignum-float-+ x y))))
;;     (rational (typecase y
;; 		(fixnum (ratio-fixnum-+ x y))
;; 		(bignum (ratio-bignum-+ x y))
;; 		(rational (ratio-rational-+ x y))
;; 		(float (ratio-float-+ x y))))
;;     (float (typecase y
;; 	     (fixnum (float-fixnum-+ x y))
;; 	     (bignum (float-bignum-+ x y))
;; 	     (rational (float-rational-+ x y))
;; 	     (float (float-float-+ x y))))))

;; ;;; subtraction
;; (defun binary-- (x y)
;;   (check-type x number "a number")
;;   (check-type y number "a number")
;;   (typecase x
;;     (fixnum (typecase y
;; 	      (fixnum (fixnum-fixnum-- x y))
;; 	      (bignum (fixnum-bignum-- x y))
;; 	      (rational (fixnum-rational-- x y))
;; 	      (float (fixnum-float-- x y))))
;;     (bignum (typecase y
;; 	      (fixnum (bignum-fixnum-- x y))
;; 	      (bignum (bignum-bignum-- x y))
;; 	      (rational (bignum-rational-- x y))
;; 	      (float (bignum-float-- x y))))
;;     (rational (typecase y
;; 		(fixnum (ratio-fixnum-- x y))
;; 		(bignum (ratio-bignum-- x y))
;; 		(rational (ratio-rational-- x y))
;; 		(float (ratio-float-- x y))))
;;     (float (typecase y
;; 	     (fixnum (float-fixnum-- x y))
;; 	     (bignum (float-bignum-- x y))
;; 	     (rational (float-rational-- x y))
;; 	     (float (float-float-- x y))))))

 
;; ;;; multiplication
;; (defun binary-* (x y)
;;   (check-type x number "a number")
;;   (check-type y number "a number")
;;   (typecase x
;;     (fixnum (typecase y
;; 	      (fixnum (fixnum-fixnum-* x y))
;; 	      (bignum (fixnum-bignum-* x y))
;; 	      (rational (fixnum-rational-* x y))
;; 	      (float (fixnum-float-* x y))))
;;     (bignum (typecase y
;; 	      (fixnum (bignum-fixnum-* x y))
;; 	      (bignum (bignum-bignum-* x y))
;; 	      (rational (bignum-rational-* x y))
;; 	      (float (bignum-float-* x y))))
;;     (rational (typecase y
;; 		(fixnum (ratio-fixnum-* x y))
;; 		(bignum (ratio-bignum-* x y))
;; 		(rational (ratio-rational-* x y))
;; 		(float (ratio-float-* x y))))
;;     (float (typecase y
;; 	     (fixnum (float-fixnum-* x y))
;; 	     (bignum (float-bignum-* x y))
;; 	     (rational (float-rational-* x y))
;; 	     (float (float-float-* x y))))))

;; ;;; division
;; (defun binary-/ (x y)
;;   (check-type x number "a number")
;;   (check-type y number "a number")
;;   (typecase x
;;     (fixnum (typecase y
;; 	      (fixnum (fixnum-fixnum-/ x y))
;; 	      (bignum (fixnum-bignum-/ x y))
;; 	      (rational (fixnum-rational-/ x y))
;; 	      (float (fixnum-float-/ x y))))
;;     (bignum (typecase y
;; 	      (fixnum (bignum-fixnum-/ x y))
;; 	      (bignum (bignum-bignum-/ x y))
;; 	      (rational (bignum-rational-/ x y))
;; 	      (float (bignum-float-/ x y))))
;;     (rational (typecase y
;; 		(fixnum (ratio-fixnum-/ x y))
;; 		(bignum (ratio-bignum-/ x y))
;; 		(rational (ratio-rational-/ x y))
;; 		(float (ratio-float-/ x y))))
;;     (float (typecase y
;; 	     (fixnum (float-fixnum-/ x y))
;; 	     (bignum (float-bignum-/ x y))
;; 	     (rational (float-rational-/ x y))
;; 	     (float (float-float-/ x y))))))

<commit_msg>Restrict to fixnum arithmetic at the moment.<commit_after>(cl:in-package #:sicl-arithmetic)

;;; Right now, we support only fixnum arithmetic.  

(defun binary-+ (x y)
  (etypecase x
    (fixnum (etypecase y
	      (fixnum (fixnum-+ x y))))))

(defun binary-- (x y)
  (etypecase x
    (fixnum (etypecase y
	      (fixnum (fixnum-- x y))))))

(defun binary-* (x y)
  (etypecase x
    (fixnum (etypecase y
	      (fixnum (fixnum-* x y))))))

(defun binary-/ (x y)
  (etypecase x
    (fixnum (etypecase y
	      (fixnum (fixnum-/ x y))))))

(defun binary-< (x y)
  (etypecase x
    (fixnum (etypecase y
	      (fixnum (fixnum-< x y))))))

(defun binary-<= (x y)
  (etypecase x
    (fixnum (etypecase y
	      (fixnum (fixnum-<= x y))))))

(defun binary-> (x y)
  (etypecase x
    (fixnum (etypecase y
	      (fixnum (fixnum-> x y))))))

(defun binary->= (x y)
  (etypecase x
    (fixnum (etypecase y
	      (fixnum (fixnum->= x y))))))

(defun binary-= (x y)
  (etypecase x
    (fixnum (etypecase y
	      (fixnum (fixnum-= x y))))))

{'fraction_non_alphanumeric': 0.21256454388984508, 'fraction_numerical': 0.0, 'mean_word_length': 2.3446043165467625, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4597738', 'n_tokens_mistral': 2021, 'n_tokens_neox': 1883, 'n_words': 506}