black-is-white.taq

$ java -jar taq.jar black-is-white

Running query color_query in global scope color_query((name=“white”, red=255, green=255, blue=255))

Running query dyna_query in global scope dyna_query(dyna_list(name=white, red=255, green=255, blue=255))

Running query list_query in global scope list_query(axiom_list(name=“white”, red=255, green=255, blue=255))

Description

black-is-white.taq shows updates of term values in three different contexts. Each demonstration changes the color “black” into “white”. The color is specified by both name and red-green-blue components.

The “color_query” query selects the “inverse” template to transform axiom “color_axiom”. The white color values are returned as expected.

The “dyna_query” query selects the “dyna_inverse” template to change the first item of dynamic axiom list “dyna_list”. he white color values are returned as expected.

The “list_query” query selects the “list_inverse” template to change the first item of the “axiom_list” axiom list. The white color values are returned as expected.


string color = "black"
list<integer> rgb = { 0, 0, 0 }

axiom color_axiom
(name, red, green, blue)
{"black", 0, 0, 0}

template inverse
{ list<term> term_list = list color_axiom }
(
// Set inverse name
. term_list->name = "white",
// Invert colors
. term_list->red ^= 255,
. term_list->green ^= 255,
. term_list->blue ^= 255,
term color_axiom
)

axiom list axiom_list
(name, red, green, blue)
{"black", 0, 0, 0}

template list_inverse
(
// Set inverse name
. name = axiom_list[0]->name = "white",
// Invert colors
. red = axiom_list[0]->red ^= 255,
. green = axiom_list[0]->green ^= 255,
. blue = axiom_list[0]->blue ^= 255,
term axiom_list[0]
)

list<axiom> dyna_list
(name, red, green, blue)
{color, rgb[0], rgb[1], rgb[2]}

template dyna_inverse
(
// Set inverse name
. dyna_list[0]->name = "white",
// Invert colors
. dyna_list[0]->red ^= 255,
. dyna_list[0]->green ^= 255,
. dyna_list[0]->blue ^= 255,
term dyna_list[0]
)

query<term> color_query(inverse)
query<term> dyna_query(dyna_inverse)
query<term> list_query(list_inverse)