I'm trying to set a value for a point in a multidimensional array using:
(vector-set! (vector-ref array (car xy)) (cadr xy) step_count)
But I'm getting this error:
vector-ref: contract violation
expected: exact-nonnegative-integer?
given: '(- (car xy) 1)
argument position: 2nd
other arguments...:
'#(#(1 0 0 0 0) #(0 0 0 0 0) #(0 0 0 0 0) #(0 0 0 0 0) #(0 0 0 0 0))
;the value 1 at position (0,0) was set before by a similar line of code
xy values are generated by a separate function
I think my (car xy) is coming out of that function as a list. How do I stop this from happening?
Thanks for reading everyone!
Your list
invocations are wrong. You should use, for example, something like this:
(cons (list (+ (car xy) 2) (- (cadr xy) 1)) successors)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.