9 years
edited 8 years
True and False BooleanExpressions
Credits goes to Vexorian for the first idea.
Vjass version
Zinc version
Credits goes to Vexorian for the first idea.
Vjass version
1 library BoolexprUtils2 3 globals4 boolexpr BOOLEXPR_TRUE
5 boolexpr BOOLEXPR_FALSE
6 endglobals7 8 private module Init
9 10 private static method filterTrue takes nothing returns boolean
11 return true
12 endmethod13 14 private static method filterFalse takes nothing returns boolean
15 return false
16 endmethod17 18 private static method onInit takes nothing returns nothing
19 set BOOLEXPR_TRUE = Filter(function thistype.filterTrue)
20 set BOOLEXPR_TRUE = Filter(function thistype.filterFalse)
21 endmethod22 23 endmodule24 25 private struct S extends array
26 implement Init27 endstruct28 29 endlibrary
Zinc version
1 //! zinc2 library BoolexprUtils {3 4 public boolexpr BOOLEXPR_TRUE, BOOLEXPR_FALSE;
5 6 module Init {7 static method onInit() {
8 BOOLEXPR_TRUE = Filter(function() -> boolean {return true;});
9 BOOLEXPR_FALSE = Filter(function() -> boolean {return false;});
10 }
11 }
12 13 struct S extends array {module Init;}
14 15 }
16 //! endzinc
