<commit_before>#lang racket

(provide
	convert-base
)

#|
Convert num from base from-rad to base to-rad
|#
(define (convert-base num from-rad to-rad)
  	(with-handlers ([exn:fail? (lambda (v) #f)])
      (if (and (member (string->number to-rad) (range 2 17 1))
               (member (string->number from-rad) (range 2 17 1)))
        (convert-to-string (string->number num (string->number from-rad))
                           (string->number to-rad))
      #f)))

#|
Converts num to a string with radix to-rad
|#
(define (convert-to-string num to-rad)
	(define (do-thing num to-rad so-far)
		(cond
			[(< num to-rad) (string-append (number->string num 16) so-far)]
			[else (do-thing (floor (/ num to-rad)) to-rad
							(string-append (number->string (modulo num to-rad) 16) so-far))]))
	
	(do-thing num to-rad ""))<commit_msg>made it always return a string..lol<commit_after>#lang racket

(provide
	convert-base
)

#|
Convert num from base from-rad to base to-rad
|#
(define (convert-base num from-rad to-rad)
  	(with-handlers ([exn:fail? (lambda (v) "No.")])
      (if (and (member (string->number to-rad) (range 2 17 1))
               (member (string->number from-rad) (range 2 17 1)))
        (convert-to-string (string->number num (string->number from-rad))
                           (string->number to-rad))
      "No.")))

#|
Converts num to a string with radix to-rad
|#
(define (convert-to-string num to-rad)
	(define (do-thing num to-rad so-far)
		(cond
			[(< num to-rad) (string-append (number->string num 16) so-far)]
			[else (do-thing (floor (/ num to-rad)) to-rad
							(string-append (number->string (modulo num to-rad) 16) so-far))]))
	
	(do-thing num to-rad ""))
{'fraction_non_alphanumeric': 0.16824644549763032, 'fraction_numerical': 0.014218009478672985, 'mean_word_length': 2.7367256637168142, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '7531916', 'n_tokens_mistral': 650, 'n_tokens_neox': 591, 'n_words': 179}