<commit_before>;;; Extra math definitions

(defun 1+ (n)
  "Return argument plus one."
  (+ n 1))

(defun 1- (n)
  "Return argument minus one."
  (- n 1))

(defun min (n &rest ns)
  "Return smallest argument."
  (cond
   ((nullp ns) n)
   ((= (length ns) 1) (if (< n (car ns)) n (car ns)))
   (t (min n (apply min ns)))))

(defun max (n &rest ns)
  "Return largest argument."
  (cond
   ((nullp ns) n)
   ((= (length ns) 1) (if (> n (car ns)) n (car ns)))
   (t (max n (apply max ns)))))

(defun abs (x)
  "Return absolute value of number."
  (if (> x 0) x
    (- x)))

(defun int-expt (b p)
  "Exponent with only integer exponent."
  (if (= p 0) 1
    (* b (int-expt b (1- p)))))

(defun nth-root (b n)
  "Return nth root of b."
  (if (< b 0)
      (throw 'domain-error b)
    (let ((x (/ b 2.0)))
      (while (> (abs (- (int-expt x n) b)) 0.00000001)
	(setq x (* (/ 1.0 n) (+ (* (1- n) x) (/ b (int-expt x (1- n)))))))<commit_msg>Get rid of no-longer-needed int-expt.<commit_after>;;; Extra math definitions

(defun 1+ (n)
  "Return argument plus one."
  (+ n 1))

(defun 1- (n)
  "Return argument minus one."
  (- n 1))

(defun min (n &rest ns)
  "Return smallest argument."
  (cond
   ((nullp ns) n)
   ((= (length ns) 1) (if (< n (car ns)) n (car ns)))
   (t (min n (apply min ns)))))

(defun max (n &rest ns)
  "Return largest argument."
  (cond
   ((nullp ns) n)
   ((= (length ns) 1) (if (> n (car ns)) n (car ns)))
   (t (max n (apply max ns)))))

(defun abs (x)
  "Return absolute value of number."
  (if (> x 0) x
    (- x)))

(defun nth-root (b n)
  "Return nth root of b."
  (if (< b 0)
      (throw 'domain-error b)
    (let ((x (/ b 2.0)))
      (while (> (abs (- (expt x n) b)) 0.00000001)
	(setq x (* (/ 1.0 n) (+ (* (1- n) x) (/ b (expt x (1- n)))))))
{'fraction_non_alphanumeric': 0.21694915254237288, 'fraction_numerical': 0.02768361581920904, 'mean_word_length': 2.458984375, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '4394908', 'n_tokens_mistral': 793, 'n_tokens_neox': 736, 'n_words': 279}