title: Scheme's "expected a procedure that can be applied to arguments"
body: <p>I use DrRacket. I have problem with this code:</p>
  
  <pre><code>          (define (qweqwe n) (
                        (cond 
                          [(&lt; n 10) #t]
                          [(&gt;= (lastnum n) (pochtilastnum n)) (qweqwe (quotient n 10))]
                          [else #f]
                          )
                        )
      )
      (define ( RTY file1 file2 )
  
       (define out (open-output-file file2 #:mode  'text #:exists 'replace))  
      (define in (open-input-file file1)) 
      (define (printtofile q) (begin
                     (write q out)
                     (display '#\newline out)
                     ))
         (define (next) 
            (define n (read in)) 
  (cond 
        [(equal? n eof) #t]
        [else (begin
        ((if (qweqwe n) (printtofile n) #f))
        ) (next)]
        )
  )
      (next)   
     (close-input-port in)
     (close-output-port out)) 
  </code></pre>
  
  <p>But when I start ( RTY "in.txt" "out.txt" ) I have an error at ((if (qweqwe n) (printtofile n) #f)) :</p>
  
  <pre><code>    application: not a procedure;
      expected a procedure that can be applied to arguments
      given: #f
      arguments...: [none]
  </code></pre>
  
  <p>What's the problem?</p>
  
  <p><strong>ADD:</strong> I changedmy code to:</p>
  
  <pre><code>(cond 
        [(equal? n eof) #t]
        [else
        (if (qweqwe n) (printtofile n) #f)
        (next)]
        )
  </code></pre>
  
  <p>But the problem remains.</p>