我正在与DCG一起玩,我有此代码。这将显示x
0
S和x
的A
s数字。
y --> test(Count), as(Count).
test(0) --> [].
test(succ(0)) --> [0].
test(succ(succ(Count))) --> [0], test(Count), [0].
as(0) --> [].
as(succ(Count)) --> [a],as(Count).
我的问题是如何通过函子使A
s的数量增加0
s的数量。这是我尝试的,但它不起作用。
y --> test(Count), as(add(Count,Count,R)).
如果我只想添加一个,这就是做什么,它可以正常工作。
y --> test(Count), as(succ(Count)).
y --> test(Count), as(Count), as(Count).
或
y --> test(Count), {add(Count,Count,DCount)}, as(DCount).
,也可以将succ
的CC_7加倍
y --> test(Count), as(Count).
test(0) --> [].
test(succ(succ(Count))) --> [0], test(Count).
as(0) --> [].
as(succ(Count)) --> [a], as(Count).