-1
(define (button-check c e)
   (begin 
     (send frame-operations show #f)
     (cond ((eq? c add-button) (begin (if (eq? (check-ans quest_num 1) 0) 
                                 ((send frame-ops-correct center 'both) 
                                  (send frame-ops-correct show #t))
                                 ((send frame-ops-wrong center 'both) 
                                  (send frame-ops-wrong show #t)))))

There are some more codes after this to handle other cases, but seems like the error was caused because of the send frame. I've tried using cond instead of if, or use "and" for the two conditions, and tried to add begin for the predicates, but all these doesn't work. Any thoughts please?

1 Answers1

1

In a vast majority of cases where one encounters a "not a procedure" error, it's usually caused by having too many parentheses, or trying to use parentheses for "grouping" (you have to use begin for that instead). In your case, your code should be:

(if (zero? (check-ans quest_num 1))
    (begin
      (send frame-ops-correct center 'both)
      (send frame-ops-correct show #t))
    (begin
      (send frame-ops-wrong center 'both)
      (send frame-ops-wrong show #t)))

Notice how I added begin to both branches of the if. Also, don't use eq? with numbers; use eqv? instead. But since we're comparing with zero, I changed your code to use zero? instead.

C. K. Young
  • 219,335
  • 46
  • 382
  • 435