Skip to content

Instantly share code, notes, and snippets.

@ayato-p
Created February 13, 2013 00:04
Show Gist options
  • Save ayato-p/4774808 to your computer and use it in GitHub Desktop.
Save ayato-p/4774808 to your computer and use it in GitHub Desktop.
Euler-11の為に。。。
(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