Advertisement
PonaFly

functions (№3 19)

Apr 13th, 2016
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.40 KB | None | 0 0
  1. #lang scheme
  2. (define (functions)
  3.  (define in (open-input-file "inputF.txt"))
  4.   (define (iter i word)
  5.     (define ch (read-char in))
  6.     (if (equal? ch eof) i
  7.       (cond
  8.         ((equal? ch #\( ) (if (equal? word '(#\e #\n #\i #\f #\e #\d)) (iter (+ 1 i) '()) (iter i '())))
  9.         ((or(equal? ch #\space) (equal? ch #\newline)) (iter i word))
  10.         (else (iter i (cons ch word))))))
  11.   (iter 0 '()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement