0

I'm trying to make tic-tac-toe in scheme and when trying to refer to a variable I get application: not a procedure;

(display "1 turn")
(define spot (read-line))
(vector-set! row
             (spot)
             1)
(print-gameboard) ; just a display function

I expected this to change the vector into 1 0 0 0 0 0 0 0 0 if I give it one, but I just get application: not a procedure;

Tas Long
  • 89
  • 1
  • 4

1 Answers1

1

Here's the problem:

(vector-set! row
             (spot) ; spot is not a procedure
             1)

The variable spot is just a value that you read from the REPL; don't surround values with (), that's how you call a procedure in Scheme. Just pass it along:

(vector-set! row spot 1)

But, if you truly intended to make spot a procedure, this is how it should be declared:

(define (spot) (read-line))
Óscar López
  • 232,561
  • 37
  • 312
  • 386