我正在爲一個類進行家庭作業分配。問題陳述說,使用數據定義:在方案中定義一個字段的結構體
(define-struct diff-exp exprs)
(define-struct mult-exp exprs)
;; An Expr is one of
;; -- Number
;; -- (make-diff-exp (cons Expr LOExpr))
;; -- (make-mult-exp (cons Expr LOExpr))
;; Interpretation: a diff-exp represents a difference,
;; and a mult-exp represents a multiplication.
;; A List of Exprs (LOExpr) is one of
;; -- empty
;; -- (cons Expr LOExpr)
然而,當我剛剛在源,計劃博士(中級學員語言)說:
define-struct: expected a sequence of field names after the structure type name in `define-struct', but found something else
有什麼事我在這裏失蹤還是我的老師給我一個無效的數據定義?
我懷疑你應該將'exprs'定義爲一個元素的列表。 – 2010-02-11 01:38:35