【问题标题】:what is the meaning of infixr in Agda?Agda 中的中缀是什么意思?
【发布时间】:2013-06-30 10:36:04
【问题描述】:
Prp : Set₁
Prp = Set


data _∧_ (P Q : Prp) : Prp where
  ∧-intro : P -> Q -> P ∧ Q

infixr 2 _∧_

data _∨_ (P Q : Prp) : Prp where
  ∨-intro₁ : P -> P ∨ Q
  ∨-intro₂ : Q -> P ∨ Q

infixr 1 _∨_

示例代码中有部分代码。我只是想知道中缀器的含义是什么,以及为什么在那里使用它。

谢谢

【问题讨论】:

  • 它将 V 设置为右关联(中缀l在左):'a V b V c ' 然后是 'a V (b V c)'。 '1' 是与其他中缀运算符混合时的优先级。

标签: agda


【解决方案1】:

重要的是不要在表达式中写括号

a b c

a * b + c

infixr/infixl - 是 (r=right, l=left) 的幂,当它用于中缀(中间)位置时

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-29
    • 2020-07-28
    • 1970-01-01
    • 1970-01-01
    • 2010-10-03
    • 1970-01-01
    相关资源
    最近更新 更多