【发布时间】:2014-02-27 09:55:12
【问题描述】:
我正在尝试使用以下方法为多维数组中的点设置一个值:
(vector-set! (vector-ref array (car xy)) (cadr xy) step_count)
但是我收到了这个错误:
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 值由单独的函数生成
我认为我的 (car xy) 正在以列表的形式退出该功能。我该如何阻止这种情况发生?
感谢大家阅读!
【问题讨论】:
标签: arrays list function multidimensional-array racket