解説:condition

 フラグ(flag,position-flag,attributeなど)の内容で、trueまたはfalseです。
 「not」により、反転した内容を判定できます。
 「or」や「and」により、複数のフラグをまとめて1つのフラグとして判定できます。

  • (flag? <flag-name>)

※「(not-flag? <flag-name>)」=(not (flag? <flag-name>))

  • <position-condition>

※「empty?」や「not-empty?」=(not empty?)など

  • (not <condition>)
 条件<condition>でない場合

  • (or <condition1>...<conditionN>)
 条件1<condition1>または・・・または条件N<conditionN>の場合

  • (and <condition1>...<conditionN>)
 条件1<condition1>かつ・・・かつ条件N<conditionN>の場合

  • 否定:not
flag1 (flag <flag1>) (not-flag <flag1>)
true true false
false false true

attibute1 <attibute1> (not <attribute1>)
true true false
false false true

  • 論理和:or
  (or (flag <flag1>) (flag <flag2>))
flag1 flag2=true flag2=false
true true true
false true false

  (or <attribute1> <attribute2>)
attribute1 attibute2=true attibute2=false
true true true
false true false

  • 論理積:and
  (and (flag <flag1>) (flag <flag2>))
flag1 flag2=true flag2=false
true true false
false false false

  (and <attribute1> <attribute2>)
attribute1 attibute2=true attibute2=false
true true false
false false false

  • ド・モルガンの法則

①(not (and (flag <flag1>) (flag <flag2>)))=(or (not-flag <flag1>) (not-flag <flag2>))
 andしたフラグの否定は、否定したフラグのorです。

②(not (or (flag <flag1>) (flag <flag2>)))=(and (not-flag <flag1>) (not-flag <flag2>))
 orしたフラグの否定は、否定したフラグのandです。

※フラグが3個以上でも、同様の関係が成り立ちます。



最終更新:2020年08月28日 17:14