Adder is a small but usable subset of the Python language. It is named for the Blackadder comedy series, much as the Python language is named for Monty Python.
Add cases to valueOfUop for each of the valid combinations of unary operators and operand. Note: Any combinations not covered by what you implement will simply be undefined.
[x] Negative - valid only for integer and float values, flip the sign
[x] Positive - valid only for integer and float values, do nothing but pass the value through unchanged
[x] Logical Negation - initially only for Boolean values, flip the truth value as usual
Note: The implementation of not here will serve as an initial implementation. Time permitting, we may tweak this later to make it more faithful to how Python does things, where we determine the "truthiness" of the operand and then return an appropriate Boolean.
@Marist-CMPT331-TOPL/students Depends on #42
Add cases to
valueOfUop
for each of the valid combinations of unary operators and operand. Note: Any combinations not covered by what you implement will simply beundefined
.Note: The implementation of
not
here will serve as an initial implementation. Time permitting, we may tweak this later to make it more faithful to how Python does things, where we determine the "truthiness" of the operand and then return an appropriate Boolean.