I'm trying to write some logical statements in Perl6.
I've made logical operators:
multi sub prefix:<¬> ($n) {
return not $n;
}
multi sub infix:<∧> ($n, $b) {
return ($n and $b);
}
multi sub infix:<∨> ($n, $b) {
return ($n or $b);
}
multi sub infix:<⇒> ($n, $b) {
if $n == True and $b == True {
return True;
} elsif $n == True and $b == False {
return False;
} elsif $n == False {
return True;
}
}
multi sub infix:<⇐> ($n, $b) {
return $b ⇒ $n;
}
But would like to be able to introduce new symbols for true and false. At the moment, I have:
say ((False ⇒ ¬(False ∨ True)) ∧ (False ∨ True));
But, I would like:
say ((⟂ ⇒ ¬(⟂ ∨ ⊤)) ∧ (⟂ ∨ ⊤));
I thought maybe I could make define these symbols as constants:
constant ⊤ = True;
constant ⊥ = False;
But, if I do that then I get this error:
Missing initializer on constant declaration at /home/devXYZ/projects/test.pl6:1