Advertisement
PonaFly

good?(20-n2)

Apr 19th, 2016
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. (define (good?)
  2. (define in (open-input-file "peaks.txt"))
  3. (define numberofpeaks (function (string->list(read-line in)) 0 0))
  4. (define (iter)
  5. (define line (read-line in))
  6. (if (equal? line eof) true
  7. (if (=(function (string->list line) 0 0) (- numberofpeaks 1)) (iter) false)))
  8. (iter))
  9.  
  10. (define (function lst number degree) ;функция выделяет первое число в строке
  11. (if (or (equal? #\space (car lst)) (equal? #\return (car lst))) number
  12. (function (cdr lst) (+ number (*(- (char->integer (car lst)) 48) (expt 10 degree))) (+ 1 degree))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement