Dissimilar conditionals in filtering things

Carry out pouring_in_anything:
	let rando_container be random visible container that is not a portal and that does not contain the noun;
		try inserting noun into rando_container;

The let rando_container line throws “I didn’t understand” errors. However, these two lines work okay:

let rando_container be random visible container that is not a portal;
let rando_container be random visible container that does not contain the noun;

I think I’ve tried every possible variation with parenthesis and placement of “that”, but no dice.

Suggestions?

You can define most of these conditions as single-word adjectives:

Definition: a thing is non-portaly if it is not a portal.

Definition: a thing is non-noun-containing if it does not contain the noun.

...	let rando_container be random visible non-portaly non-noun-containing container;

1 Like

That works. It makes me curious about two things:

  • Why doesn’t the original condition work? and

  • How do definitions work behind the scenes? We tend to think of definitions as set in stone, but here is clearly done dynamically.

The compiler isn’t smart enough to parse the compound conditional.

Does it help if I say “a definition is a function that takes one object and returns a boolean”?

It’s just a test which can be applied to an object. The test can contain any code, including references to global variables like noun.

What it can’t handle is references to local variables. You can’t write a definition for “non-containing T” where T is a parameter.

2 Likes

I’ll note that you’d be fine with one relative phrase, i.e., either of

let rando_container be random visible non-portaly container
  that does not contain the noun; [or]
let rando_container be random visible non-noun-containing container
  that is not a portal;

work.