我试图遵循this question中提供的解决方案,但它根本无法工作。计划开始学生,功能机构额外部分
从本质上讲,我的功能就像这样:
(define (item-price size normal-addons premium-addons discount)
(define price 0)
(+ price (* normal-addon-cost normal-addons) (* premium-addon-cost premium-addons) size)
(cond
.. some conditions here
[else price]))
不过,我遇到了以下错误:
define: expected only one expression for the function body, but found 2 extra parts
现在,我已经试过包装的函数体在'开始',但是当它运行时声称'开始'没有被定义。我使用初学者学生语言版本反对直接球拍。有关解决方法的任何见解?
请注意:'(+ price ...)'行不符合您的想象。它正在计算一个值,但是这个值会丢失,因为你没有分配它 - “价格”的值不会被更新! – 2014-09-22 19:55:25