我使用 DrRacket。我对这段代码有疑问:
          (define (qweqwe n) (
                      (cond 
                        [(< n 10) #t]
                        [(>= (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)) 
但是当我开始( RTY "in.txt" "out.txt" )时,我在 ((if (qweqwe n) (printtofile n) #f)) 处出现错误:
    application: not a procedure;
    expected a procedure that can be applied to arguments
    given: #f
    arguments...: [none]
有什么问题?
添加:我将代码更改为:
(cond 
      [(equal? n eof) #t]
      [else
      (if (qweqwe n) (printtofile n) #f)
      (next)]
      )
但问题依然存在。