I want to use a variable named split_point inside a the substring function. I calculated the split point using these functions:
(list (substring num 0 split_point) (substring num split_point))
(define (log_2 decimal)
(floor(/ (log decimal) (log 2))))
(define (find_size_in_byte num)
(floor (+ 10 (log_2 num))))
When I try to use the split_point variable inside substring I get the error:
substring: contract violation
expected: exact-nonnegative-integer?
given: 2.0
I tried using **floor **inside the code:
`
(list (substring num 0 split_point) (substring num split_point))
I also tried to use exact and round but I couldn’t solve it.
New contributor
Umut Şendağ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.