Fix runtime error in (the Int (cast "")).

This commit is contained in:
Matus Tejiscak 2020-03-29 20:33:46 +02:00
parent 725e5ac13d
commit 2cadbd2cd1
3 changed files with 6 additions and 3 deletions

View File

@ -19,7 +19,8 @@
(if (number? x) x 0)))
(define destroy-prefix
(lambda (x)
(if (eqv? (string-ref x 0) #\#) "" x)))
(if (eqv? x "") ""
(if (eqv? (string-ref x 0) #\#) "" x))))
(define cast-string-int
(lambda (x)
(floor (cast-num (string->number (destroy-prefix x))))))

View File

@ -19,7 +19,8 @@
(if (number? x) x 0)))
(define destroy-prefix
(lambda (x)
(if (eqv? (string-ref x 0) #\#) "" x)))
(if (eqv? x "") ""
(if (eqv? (string-ref x 0) #\#) "" x))))
(define cast-string-int
(lambda (x)
(floor (cast-num (string->number (destroy-prefix x))))))

View File

@ -19,7 +19,8 @@
(if (number? x) x 0)))
(define destroy-prefix
(lambda (x)
(if (eqv? (string-ref x 0) #\#) "" x)))
(if (eqv? x "") ""
(if (eqv? (string-ref x 0) #\#) "" x))))
(define cast-string-int
(lambda (x)
(floor (cast-num (string->number (destroy-prefix x))))))