2011년 3월 1일 화요일

Boolean Algebra and Comparison Operators

erl>true and false.

hs>True && False

erl>false or true

hs>False || True

erl>not false.

hs>not False



erl> 5 =:= 5.

hs> 5 == 5

erl> 1 =:= 0.

hs> 1 == 0

erl> 1 =/= 0.

hs> 1 /= 0



erl> 5.0 =:= 5.

hs> 5.0 == 5



erl> 1<2.

hs> 1<2

erl> 1>=1.

hs> 1>=1

erl> 1=<1.

hs> 1<=1



erl> 5=:=true.

false

hs> 5 == True





<interactive>:1:0:

    No instance for (Num Bool)

      arising from the literal `5' at <interactive>:1:0

    Possible fix: add an instance declaration for (Num Bool)

    In the first argument of `(==)', namely `5'

    In the expression: 5 == True

    In the definition of `it': it = 5 == True





erl> 0==false.

false

댓글 없음:

댓글 쓰기