moved char->number to common.scm
This commit is contained in:
@@ -2,10 +2,6 @@
|
|||||||
|
|
||||||
(load "../common.scm")
|
(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
|
; returns a number from two characters
|
||||||
; ex: '0' and '9' => 9
|
; ex: '0' and '9' => 9
|
||||||
; ' ' and '6' => 6
|
; ' ' and '6' => 6
|
||||||
|
|||||||
@@ -7,3 +7,8 @@
|
|||||||
[(char=? c #\,) (loop (cons n draws) 0)]
|
[(char=? c #\,) (loop (cons n draws) 0)]
|
||||||
[(char-whitespace? c) (reverse (cons n draws))]
|
[(char-whitespace? c) (reverse (cons n draws))]
|
||||||
[else (loop draws (+ (* n 10) (string->number (string c))))]))))
|
[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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user