Advertisement
PonaFly

isolated (20-n1)

Apr 19th, 2016
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. (define (isolated )
  2. (define in (open-input-file "matrix.txt"))
  3. (define (iter i Nstr)
  4. (define line (read-line in))
  5. (if (equal? line eof) i
  6. (iter (+(help (string->list line) Nstr 1) i) (+ 1 Nstr) )))
  7. (iter 0 1))
  8. (define (help lst Nstr i)
  9. (cond
  10. ( (equal? (car lst) #\return ) 1)
  11. ( (equal? Nstr i) (help (cdr lst) Nstr (+ i 1)))
  12. ( (equal? (car lst) #\1) 0)
  13. ( (equal? (car lst) #\space) (help (cdr lst) Nstr i))
  14. (else (help (cdr lst) Nstr (+ i 1)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement