wxclips:尝试使用实例时 [MSGFUN1] 和 [MSGPASS2]
wxclips: [MSGFUN1] and [MSGPASS2] while trying to use instances
我正在尝试 运行 类 在 wxclips 中,但它不起作用不知道哪里出了问题。
请注意,此代码来自教程,它应该可以工作,但不是
> CLIPS> (defclass A (is-a USER) (role concrete) (slot foo (create-accessor write)) (slot bar))
> CLIPS> (make-instance a of A (foo 36)) [a] CLIPS> (make-instance b of A (bar 45)) [MSGFUN1]
> No applicable primary message-handlers found for put-bar. FALSE CLIPS>
> CLIPS>(defclass person (is-a USER) (multislot full-name) (role concrete) (slot gender (allowed-symbols male female)) (slot age))
> CLIPS>(definstances people (mike of person(gender "male")(age 24)))
> CLIPS>(send [mike] get-gender)
[MSGPASS2] No such instance mike in function send
您需要为要读取或写入的任何插槽创建插槽访问器,并且在您发出(重置)命令之前不会创建来自定义实例的实例。
CLIPS> (defclass A (is-a USER) (role concrete) (slot foo(create-accessor write)) (slot bar (create-accessor write)))
CLIPS> (make-instance a of A (foo 36))
[a]
CLIPS> (make-instance b of A (bar 45))
[b]
CLIPS> (defclass person (is-a USER) (multislot full-name) (role concrete) (slot gender (allowed-symbols male female) (create-accessor read-write)) (slot age (create-accessor read-write)))
CLIPS> (definstances people (mike of person(gender "male")(age 24)))
CLIPS> (reset)
CLIPS> (send [mike] get-gender)
"male"
我正在尝试 运行 类 在 wxclips 中,但它不起作用不知道哪里出了问题。 请注意,此代码来自教程,它应该可以工作,但不是
> CLIPS> (defclass A (is-a USER) (role concrete) (slot foo (create-accessor write)) (slot bar))
> CLIPS> (make-instance a of A (foo 36)) [a] CLIPS> (make-instance b of A (bar 45)) [MSGFUN1]
> No applicable primary message-handlers found for put-bar. FALSE CLIPS>
> CLIPS>(defclass person (is-a USER) (multislot full-name) (role concrete) (slot gender (allowed-symbols male female)) (slot age))
> CLIPS>(definstances people (mike of person(gender "male")(age 24)))
> CLIPS>(send [mike] get-gender)
[MSGPASS2] No such instance mike in function send
您需要为要读取或写入的任何插槽创建插槽访问器,并且在您发出(重置)命令之前不会创建来自定义实例的实例。
CLIPS> (defclass A (is-a USER) (role concrete) (slot foo(create-accessor write)) (slot bar (create-accessor write)))
CLIPS> (make-instance a of A (foo 36))
[a]
CLIPS> (make-instance b of A (bar 45))
[b]
CLIPS> (defclass person (is-a USER) (multislot full-name) (role concrete) (slot gender (allowed-symbols male female) (create-accessor read-write)) (slot age (create-accessor read-write)))
CLIPS> (definstances people (mike of person(gender "male")(age 24)))
CLIPS> (reset)
CLIPS> (send [mike] get-gender)
"male"