Is it possible to hack this using the printed plural name property? I was trying to think of something that exposes the most specific kind of an item, and I can’t find any way of doing it directly (maybe someone knows this, I think it may be in the forum somewhere), but “printed plural name” seems like it does, as long as you don’t do other stuff to mess with the printed plural name – or don’t do it until you’ve done your startup stuff. So here’s a fruit code:
[code]Fruit is a kind of thing. apple is a kind of fruit. pear is a kind of fruit. A fruit is usually edible. A fruit has a number called a price. The price of a fruit is usually 0.
Grocery is a room. There are three apples in grocery. There are two pears in grocery.
Instead of examining a fruit:
say “This [noun] costs [price of the noun] dollars.”
Duplication relates a thing (called X) to a thing (called Y) when the printed plural name of X is the printed plural name of Y. The verb to duplicate (he duplicates, it is duplicated, they duplicate, it is duplicating) implies the duplication relation.
Definition: A fruit is price-set if its price is not 0.
To decide whether (X - a fruit) is price-kind-set:
repeat with item running through fruits that duplicate X:
if the price of item is not 0, decide yes;
decide no.
When play begins:
repeat with item running through fruits:
if item is price-kind-set:
let old item be a random price-set fruit that duplicates item;
now the price of item is the price of old item;
otherwise:
now the price of item is a random number from 2 to 5. [/code]
This seems to be working right now. I’m pretty groggy, so it’s probably very inelegant if it’s not bugfree. (Highlights of my attempts to get this to compile: thinking there was something going on with the syntax “a random price-set fruit that duplicates item” when I had omitted “let” from the beginning of the line; trying to use A as a variable; writing “plural name” property and thinking that there was some deep magic in trying to access that property, instead of realizing that I’d got the name wrong; and sundry other stupid bugs.)
UPDATE: In fact, my grogginess led me to complicate that unnecessarily – you don’t need the business about “price-kind-set.” This seems to work:
[code]Duplication relates a thing (called X) to a thing (called Y) when the printed plural name of X is the printed plural name of Y. The verb to duplicate (he duplicates, it is duplicated, they duplicate, it is duplicating) implies the duplication relation.
Definition: A fruit is price-set if its price is not 0.
When play begins:
repeat with item running through fruits:
if item duplicates a price-set fruit:
let old item be a random price-set fruit that duplicates item;
now the price of item is the price of old item;
otherwise:
now the price of item is a random number from 2 to 5.[/code]
I had thought that “price-set fruit that duplicates item” was making the compiler burp, when it was the missing “let” at the beginning of the line; by the time I’d fixed that I’d created a lot of extra complication.