PonaFly

ribs(20-n4)

Apr 19th, 2016
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. (define (ribs ) ;
  2. (define in (open-input-file "matrix.txt")) ;
  3. (define (iter lst i)
  4. (define line (read-line in)) ; Нумерация вершин с 1!!!
  5. (if (equal? line eof) lst
  6. (iter (append (help (string->list line) i 1 '()) lst) (+ i 1))))
  7. (iter '() 1))
  8. (define (help lst Nstr i result)
  9. (cond
  10. ( (equal? #\return (car lst)) result)
  11. ( (> i Nstr) result)
  12. ( (equal? (car lst) #\1) (help (cdr lst) Nstr (+ i 1) (cons (cons Nstr i) result)))
  13. ( (equal? #\space (car lst)) (help (cdr lst) Nstr i result))
  14. (else (help (cdr lst) Nstr (+ i 1) result))))
Add Comment
Please, Sign In to add comment