埃菲尔铁塔:有没有办法在埃菲尔铁塔上表达双重隐含子句? [英] Eiffel: is there a way to express a double implies clause in eiffel?

查看:123
本文介绍了埃菲尔铁塔:有没有办法在埃菲尔铁塔上表达双重隐含子句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像心理学中的双重约束一样,有没有办法告诉一个表达暗含另一表达呢?

Like double bind in psychology, is there a way to tell that one expression implies another and reversely?

valid_last_error: attached last_error implies not attached last_success_message
valid_last_success_message: attached last_success_message implies not attached last_error

会像

valid_last_error: attached last_error double_binded_not attached last_success_message

可能等同于

valid_last_error: attached last_error never_with attached last_success_message

  • T 代表True布尔表达式
  • F 为假
  • R 作为结果
    • T stands for True boolean expression
    • F for False
    • R for Result
    • a b R
      T T T
      T F F
      F T T
      F F T
      

      和(a,b:BOOLEAN):BOOLEAN

      a b R
      T T T
      T F F
      F T F
      F F F
      

      或(a,b:BOOLEAN):BOOLEAN

      a b R
      T T T
      T F T
      F T T
      F F F
      

      xor(a,b:BOOLEAN):BOOLEAN

      a b R
      T T F
      T F T
      F T T
      F F F
      

      double_implies(a,b:BOOLEAN):BOOLEAN

      a b R
      T T F
      T F T
      F T T
      F F T
      

      作为一个可能更具解释性的示例(众所周知),而不是写作

      as a maybe more explaining example (more known) instead of writing

      invalid_index_implies_off: index < 1 implies off
      off_implies_invalid_index: off implies index < 1
      

      我们可以这样写:

      index_coherent_with_off: index < 1 never_both off
      

      这只会向BOOLEAN类添加一个函数,例如

      which would just add a function to BOOLEAN class such as

      alias never_with, alias reversible_implies (v: like Current): like Current
          do
              if Current and v then
                  Result := False
              else
                  Result := True
              end
          end
      

      希望每个人都明白我的意思...我不知道是否有这样的算术运算符.

      Hope now everybody got my point... I don't know if there is such arithmetic operator.

      我们可以将其扩展为可变数量的参数

      推荐答案

      我的问题的唯一答案是在util类之类的函数中定义一个函数

      The only answer for my question is to define a function in an util class like

      功能-可能在BOOLEAN类中

      feature -- could be in class BOOLEAN

      double_implies, reversible_implies, never_both (a, b: BOOLEAN): BOOLEAN
              -- Into boolean class with never_with
          do
              if a and b then
                  Result := False
              else
                  Result := True
              end
          end
      

      这篇关于埃菲尔铁塔:有没有办法在埃菲尔铁塔上表达双重隐含子句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆