Is there a word for "directly supports or contains"?

Is there a word that mean “directly supports or contains”?

For example, with this code:

[code]Lab is a room.

A supporter called a table is here.
Some table-legs are part of the table.

A blue mug is a container on the table.
A blue handle is part of the blue mug.
Some coffee is a thing in the blue mug.

A container called a crate is here.
Some slats are part of the crate.

A red mug is a container in the crate.
A red handle is part of the red mug.
Some tea is a thing in the red mug.

When play begins:
say “The table encloses these things:[line break]”;
repeat with A running through things:
if the table encloses A:
say “[A][line break]”;
say “[line break]The table holds these things:[line break]”;
repeat with B running through things:
if the table holds B:
say “[B][line break]”;
say “[line break]The crate encloses these things:[line break]”;
repeat with C running through things:
if the crate encloses C:
say “[C][line break]”;
say “[line break]The crate holds these things:[line break]”;
repeat with D running through things:
if the crate holds D:
say “[D][line break]”.
[/code]

The output is:

So “encloses” is not what I want, because it includes things that are inside containers (like coffee and tea), and component parts of things (like the mug handles). “Holds” is closer, but it still includes the table-legs and the slats.

Is there a word I can use for both the table and the crate, that will catch just the mugs, and not their contents or any component parts?

If there isn’t a built-in word for it, would this be a sensible alternative?

To decide if (storage-unit - a thing) suptains (item - a thing): if (the storage-unit supports the item) or (the storage-unit contains the item), decide yes; decide no.

Or would it be better to use “holds” and add a step to filter out any items from the list that are parts of other items?

Hey bg,

I’m not sure what you want. Something like this?

When play begins: say "On the table:[line break]"; repeat with A running through things on the table: say "[a A][line break]"; say "[line break]In the crate:[line break]"; repeat with D running through things in the crate: say "[a D][line break]".

[edit: Basically, there’s lots of ways of doing this. Maybe you could show us how you’d like the output to be.]

Thanks, but I’m looking for one word that is flexible enough to apply to both containers and supporters.

Something like this:

say "The table suptains these things:[line break]"; repeat with B running through things: if the table suptains B: say "[B][line break]"; say "[line break]The crate suptains these things:[line break]"; repeat with C running through things: if the the crate suptains C: say "[C][line break]";

where the output is

I would make this a computed relation, not a decide statement. I’d probably use the verb “to bear.” That means you should be able to test whether “the candlestick bears the candle” as easily as you iterate through “the list of things borne by the table”.

OK, so like this?

Bearing relates a thing (called bearer) to a thing (called borne item) when the bearer supports the borne item or the bearer contains the borne item. The verb to bear means the bearing relation.

(Inform automatically understands “borne by.” I am impressed!)

Actually, maybe

Bearing relates an object (called bearer) to a thing (called borne item) would be better so I could use it for rooms as well.

Yeah, I think it should work. As a bonus, it’s not often I get to suggest a solution based on the translated meaning of own name, so I couldn’t really resist. :slight_smile:

Thanks!

I’d make the check even more straightforward: “bearing relates a thing (called X) to a thing (called Y) when the holder of Y is X”. “The holder of” is roughly the I7 equivalent of I6’s “parent” in the object tree, and is very efficient to check. (Only roughly because I7 does the tree a bit differently, to account for things being part of other things.)

Now, your code is entirely equivalent, and I7 might optimize it. But I’m not sure how much optimization ni actually does.

That seems to include parts of the holder, which I don’t want. So in that case it seems like there’d need to be a second condition to exclude them:

Bearing relates an object (called X) to a thing (called Y) when the holder of Y is X and Y is not part of X.

If I7 tests left-to-right, the above would be more efficient than my proposal.

Might still be faster, since Inform evaluates the left side of an “and” condition before it does the right side (and then doesn’t evaluate the right side at all if the left side is false). Still, this kind of optimisation is unlikely to be noticeable unless you make many of these checks.

Edit @ Eleas: Yes, I have been told it does. (I think by Zarf… but the memory is very hazy.)

Thanks, everyone!

If I said that, it’s because I compiled some I7 code and then look at the generated I6. :slight_smile: It’s not like I have this stuff memorized.

(But I’m pretty sure all tests are left-to-right and short-circuiting, like you said. That is true in I6, and I7 conditions are not rearranged when compiled to I6.)