13#if !defined(VITA_BOOL_PRIMITIVE_H)
14#define VITA_BOOL_PRIMITIVE_H
22namespace vita::boolean
29 { Expects(c.size() == 1); }
37 case cpp_format:
return "false";
38 case python_format:
return "False";
48 { Expects(c.size() == 1); }
56 case cpp_format:
return "true";
57 case python_format:
return "True";
66 explicit l_and(
const cvect &c) :
function(
"AND", c[0], {c[0], c[0]})
67 { Expects(c.size() == 1); }
73 return std::get<D_INT>(args[0]) && std::get<D_INT>(args[1]);
80 case python_format:
return "(%%1%% and %%2%%)";
81 default:
return "(%%1%% && %%2%%)";
89 explicit l_not(
const cvect &c) :
function(
"NOT", c[0], {c[0]})
90 { Expects(c.size() == 1); }
94 return !std::get<D_INT>(args[0]);
101 case python_format:
return "not(%%1%%)";
102 default:
return "!%%1%%";
110 explicit l_or(
const cvect &c) :
function(
"OR", c[0], {c[0], c[0]})
111 { Expects(c.size() == 1); }
117 return std::get<D_INT>(args[0]) || std::get<D_INT>(args[1]);
124 case python_format:
return "(%%1%% or %%2%%)";
125 default:
return "(%%1%% || %%2%%)";
bool associative() const final
Is the symbol subject to the associative law of arithmetic?
std::string display(format f) const final
value_t eval(symbol_params &args) const final
Calculates the value of / performs the action associated with the symbol (it's implementation specifi...
value_t eval(symbol_params &args) const final
Calculates the value of / performs the action associated with the symbol (it's implementation specifi...
std::string display(format f) const final
bool associative() const final
Is the symbol subject to the associative law of arithmetic?
std::string display(format f) const final
value_t eval(symbol_params &args) const final
Calculates the value of / performs the action associated with the symbol (it's implementation specifi...
std::string display(terminal_param_t, format f) const final
value_t eval(symbol_params &) const final
Calculates the value of / performs the action associated with the symbol (it's implementation specifi...
std::string display(terminal_param_t, format f) const final
value_t eval(symbol_params &) const final
Calculates the value of / performs the action associated with the symbol (it's implementation specifi...
A symbol with arity() > 0.
function(const std::string &, category_t, cvect)
An interface for parameter passing to functions / terminals.
format
Symbol rendering format.
A symbol with zero-arity.
std::variant< D_VOID, D_INT, D_DOUBLE, D_STRING > value_t
A variant containing the data types used by the interpreter for internal calculations / output value ...