can't iterate over things using to decide... phrase

"pretty nice blue flowers"

The field is a room. 

A flower is a kind of thing. A flower can be red or blue. 

A rose is a red flower in the field. 
A bluebell is a blue flower in the field.
A violet is a blue flower in the field.

to decide whether a flower is pretty: decide yes.

definition: a flower is nice: yes.

when play begins:
	repeat with f running through every nice flower:
		say "[f][line break]";

With this code, you can iterate over “every flower”, “every blue flower”, “every nice flower”, but not over “every pretty flower”.

Is this… you know, by design?

I mean, is there some fundamental difference between definitions and to decide phrases and times when you should be using one and not the other?

If you’re thinking ‘didn’t he ask this once before’, well, kind of.
Here: https://intfiction.org/t/to-decide-and-is-not/3490/1.

But that was about negations, this is about iterating. :-/

The decide phrase doesn’t create an adjective or property, but a condition.

The phrase

To decide whether a flower is pretty: decide yes.

contains no flower parameter; instead, it creates a literal name (viz. ‘a flower is pretty’) for a condition that is always true.

However, you can put parameters of a given type in a phrase to decide like this:

To decide whether (fleur - flower) is pretty: decide yes.

That doesn’t create a ‘pretty’ adjective, either, so it doesn’t let you write

repeat with f running through pretty flowers: say "[f][line break]";

But it does let you write tests like

repeat with f running through flowers: if f is pretty, say "[f][line break]"; (the last line edited in keeping with Matt’s remark below)

That should be “If f is pretty,” shouldn’t it?

Yeah… I guess I cut out a bit too much from my code. It’s not really about flowers.

I mean like this:

"pretty nice blue flowers"

The field is a room. 

A flower is a kind of thing. A flower can be red or blue. 

A rose is a red flower in the field. 
A bluebell is a blue flower in the field.
A violet is a blue flower in the field.

to decide whether (F - a flower) is pretty: 
	if F is blue, decide yes;
	decide no.

definition: a flower (called F) is nice if F is pretty.

[this is strange - you can iterate over every flower, every blue flower, every nice flower - but NOT over every pretty flower]
when play begins:
	repeat with F running through every nice flower:
		say "[F][line break]";

This will print out:
bluebell
violet

This is still pretty contrived - it’s using the “blue” property to decide whether it’s pretty, and then by definition saying that pretty ones are nice.

But it still stands that you can not iterate over “every pretty flower”.

BTW, you can also say “every flower which is nice” (but not “every flower which is pretty”)

Anyway, maybe it’s just as fast to iterate over every flower in the world and filter out the pretty ones inside the loop - for all practical purposes it probably won’t make a difference.

I don’t have a problem here, I’m just curious why definitions and decide to phrases work differently.

It’s because “to decide” phrases don’t create a property that’s directly tied to the object (unlike definitions). With a definition you create an adjective that can be used as such: an object can be tested whether or not it has a certain property (“nice flower”). “To decide” creates a rigid test: when you say “To decide whether (F - a flower) is pretty”, the compiler sees “is pretty” just as some string of text. It doesn’t parse it as “(thing) is (adjective)”.

“To decide” is much more flexible than “definition”. The following phrases are equally valid:

To decide whether (F - a flower) smells nice: ... To decide whether giving (F - a flower) to a girl makes her blush: ... To decide whether (F - a flower) fits in (V - a vase) on (C - a container): ... To decide whether foo blorb (F - a flower) boo pop: ...
It’s clear that the compiler wouldn’t understand “every flower that make girls blush” or “every nice smelling flower” by itself. “(thing) is (adjective)” is not an exception.

“To decide” can also be used with other data types than things.

To decide whether (message - indexed text) is short: if the number of characters in message is less than 10, decide yes; decide no.
You could test individual words (“if “flower” is short”), but you can’t iterate through them (“every short word”). (You could argue that you can’t iterate through indexed text anyway, but the point here is to show that treating “(thing) is …” as creating an adjective would clearly be special-casing.)

Darn! Yes, of course it should.