方案中的评估顺序
这是有效的:
(define obj1 (maak-object (coord 1 1) #f #f #t))
(set! karaktersenobjectenlijst (append karaktersenobjectenlijst
(list (list 'object obj1)))))
> (cadar karaktersenobjectenlijst)
obj1
> (positie obj1)
{1 . 1}
这不起作用:
> (positie (cadar karaktersenobjectenlijst))
. . vector-ref: expects type <vector> as 1st argument,
. . given: obj1; other arguments were: 0
当评估 (cadar karaktersobjectenlijst)
时,如何使其使用值 obj1
?
This is what works:
(define obj1 (maak-object (coord 1 1) #f #f #t))
(set! karaktersenobjectenlijst (append karaktersenobjectenlijst
(list (list 'object obj1)))))
> (cadar karaktersenobjectenlijst)
obj1
> (positie obj1)
{1 . 1}
This doesn't work:
> (positie (cadar karaktersenobjectenlijst))
. . vector-ref: expects type <vector> as 1st argument,
. . given: obj1; other arguments were: 0
How can I make it use the value obj1
when (cadar karaktersobjectenlijst)
is evaluated?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
代码是正确的。我已经用一些虚拟函数替换了您的函数,并且评估结果良好:
问题必须出在您的库代码或您使用它的方式中。方案评估效果良好。
The code is correct. I have replaced your functions with some dummys and it evaluates fine:
The problem must be in your library code or the way you use it. The Scheme evaluation works fine.