diff --git a/04-giant-squid/code.scm b/04-giant-squid/code.scm index 9216af8..d8e58dd 100644 --- a/04-giant-squid/code.scm +++ b/04-giant-squid/code.scm @@ -2,10 +2,6 @@ (load "../common.scm") -; returns numbers 0 to 9 from ascii character -(define (char->number c) - (- (char->integer c) 48)) ; 48 is ASCII's number zero - ; returns a number from two characters ; ex: '0' and '9' => 9 ; ' ' and '6' => 6 diff --git a/common.scm b/common.scm index e839719..e21f5c2 100644 --- a/common.scm +++ b/common.scm @@ -7,3 +7,8 @@ [(char=? c #\,) (loop (cons n draws) 0)] [(char-whitespace? c) (reverse (cons n draws))] [else (loop draws (+ (* n 10) (string->number (string c))))])))) + +; returns numbers 0 to 9 from ascii character +(define (char->number c) + (- (char->integer c) 48)) ; 48 is ASCII's number zero +