There are some unnecessary parenthesis, don’t do this:
((if (qweqwe n) (printtofile n) #f))
Try this instead:
(if (qweqwe n) (printtofile n) #f)
Also in here:
(define (qweqwe n)
((cond [(< n 10) #t]
[(>= (lastnum n) (pochtilastnum n)) (qweqwe (quotient n 10))]
[else #f])))
It should be:
(define (qweqwe n)
(cond [(< n 10) #t]
[(>= (lastnum n) (pochtilastnum n)) (qweqwe (quotient n 10))]
[else #f]))
In both cases the problem was that if you surround with () an expression, it means that you’re trying to invoke a procedure. And given that the result of the if and cond expressions above don’t return a procedure, an error occurs. Also, bothbegins in your original code are unnecessary, a cond has an implicit begin after each condition, same thing for the body of a procedure definition.