Can a rulebook be list based?

That is a strange error message.

Here’s an example of cajoling the compiler into accepting something that is approximately as easy to type as you wanted it to be. The burden would be on you to make sure that that the ordering of list elements is appropriate; I couldn’t figure out a way to convince the compiler to allow sorting parameter_object as a list of colors.

EDIT: OK, I got sorting working. So long as the same unordered list membership is present at both the “submission” (i.e. follow... ) end and the “setup” (i.e. Color checking...) end, it should work. No promises on performance, though.

"Exampling Lists"

Place is a room.

Color is a kind of value. The colors are red, orange, yellow, green, blue and purple.

The color checking rules are a list of colors based rulebook producing text.

Include (- Global color_sort_list; -) after "Definitions.i6t".

To decide whether submitted colors are (L - list of colors): [allows approximation of normal rule syntax]
    (- ( color_sort_list = {L}, LIST_OF_TY_Sort(color_sort_list, 1), LIST_OF_TY_Sort(parameter_value, 1), BlkValueCompare(parameter_value, color_sort_list) == 0) -).

Color checking when submitted colors are {red, orange, yellow}:
    rule succeeds with result "Warm in a row."

Color checking when submitted colors are {purple, green, blue}: [notice unsorted list]
    rule succeeds with result "Cool in a row."

Color checking when submitted colors are {red, orange, yellow, green, blue, purple}:
    rule succeeds with result "Full spectrum."

To say with break (T - text): [simplifies formatting for saying a text produced from a constant list of colors]
    say T;
    say paragraph break.

After waving hands:
    say with break text produced by the color checking rules for {red, orange, yellow}.

After jumping:
    say with break text produced by the color checking rules for {purple, blue, green}. [notice unsorted list]

After waiting:
    say with break text produced by the color checking rules for {red, orange, yellow, green, blue, purple}.

Test me with "wave / jump / wait".

Submitting a list of colors that varies should be OK, too.

Color checking when submitted colors are mycolorlist:
    ...
2 Likes