Created
February 13, 2013 00:04
-
-
Save ayato-p/4774808 to your computer and use it in GitHub Desktop.
Euler-11の為に。。。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (str-parse str) | |
(let loop ((ls (string->list str)) | |
(tmp-acc '()) | |
(acc '())) | |
(cond | |
((null? str) (reverse acc)) | |
(let ((c (car ls)) | |
(c2i (lambda (c) | |
(- (char->integer c) 48)))) | |
((or (char-whitespace? c) (null? (cdr ls))) | |
(loop (cdr ls) | |
tmp-acc | |
(cons ( | |
(else | |
(loop (cdr ls) | |
tmp-acc | |
(cons (c2i c) acc))))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment