Most of the time, ‘[the list of dishes]’ works great.
But I ran into a case where I definitely need ‘or’ instead of ‘and.’
The “dish-list” code below works, but is there a one-liner available to simplify things?
"Stuff" by Andrew Schultz
a dish is a kind of thing.
r1 is a room
the chicken is a dish in r1.
the veal is a dish in r1.
the fish is a dish in r1.
every turn:
say "Which dish will you pick, [dish-list]?";
to say dish-list:
let Z be the number of dishes;
let count be 0;
repeat with X running through dishes:
increment count;
say "[the x]";
if count < z, say ", ";
if count is z - 1, say "or ";
(Note: I had trouble following the I6 code down to WriteListR, but that could be an alternate solution, to add a flag for OR or AND. But that’d be a bit beyond me.)
Lab is a room.
To say or-list (l - list of values):
now or-not-and is true;
say l;
now or-not-and is false.
or-not-and is initially false.
L is initially {1 , 2, 3};
For issuing the response text of the list writer internal rule response (C) when or-not-and is true: say " or ".
when play begins:
say "[or-list L]".
Edited: Actually, this is less ugly:
list-conjunction is initially "and".
To say (l - list of values) with conjunction (t - text):
let backup be list-conjunction;
now list-conjunction is t;
say l;
now list-conjunction is backup.
To say or-list (l - list of values):
say l with conjunction "or";
For issuing the response text of the list writer internal rule response (C): say " [list-conjunction] ".
To say (l - list of values) with conjunction (t - text):
let backup be list-conjunction;
now list-conjunction is t;
say l;
now list-conjunction is backup.