如何以'or'条件编写let表达式

问题描述 投票:0回答:1

在书上实现问题A.3.6时,我需要表达以下条件:

 After putting on a glove, for the hand that the glove is on something happens while for gloves on the other hand should stay the same.

由于手套和手套的结构相同,我如何在不指定手套右手和手套左手的情况下整齐地表达条件。

我的代码在这里:https://github.com/huanhulan/alloy-exercises/blob/master/book/appendixA/gloves.als#L137

alloy
1个回答
0
投票

一种选择是将公式写在谓词中,然后传入实例化之间不同的部分(在这种情况下,leftHand和rightHand绑定到该关系)。

© www.soinside.com 2019 - 2024. All rights reserved.