Is there a way to use plural and singular words for each part of a multi number value? Eg. 1 hour 10 minutes, vs 2 hours 1 minute.
I have this code:
X is a room.
A height is a kind of value.
1 foot 11 inch (singular) specifies a height.
5 feet 11 inches (plural) specifies a height.
A person has a height.
The height of the player is 1 foot 1 inch.
But the showme output is:
height: 1 feet 1 inches
If I change the height to 0 foot 1 inch then the output is singular.
If I change the definition to:
1 foot 1 inch (singular) specifies a height.
Then it will still display:
height: 0 feet 3 inches
This is clearly wrong and I’ve defined a foot as being 2 inches.
If I change it to this:
X is a room.
A height is a kind of value.
1 foot (singular) 11 inch (singular) specifies a height.
5 feet (plural) 11 inches (plural) specifies a height.
A person has a height.
The height of the player is 1 foot 1 inch.
It errors, because the first (singular) is now part of the specification.
I tried to look at how time is defined in the standard rules but it seems to be on a lower level.
Is there a good way to do this that I haven’t found, or do I need to build this up more manually? (Or just let the singular/plural forms be the same)
Hmm, I tried several things (which I included in the code below, in square brackets) and I don’t know why this happens.
Perhaps if you included Graham Nelson’s extension “Metric Units” or “Approximate Metric Units?”
If you simply ignore singulars and plurals, the code compiles, as in:
X is a room. Lady Gaga is a woman in X.
A height is a kind of value.
[1 foot (singular) specifies a height.
2 feet (plural) specifies a height.
1 inch (singular) specifies a height scaled down by 12.
2 inches (plural) specifies a height scaled down by 12.]
5 feet 11 inches specifies a height.
A person has a height.
The height of Lady Gaga is 5 feet 2 inches.
After examining Gaga, say "She is [the height of Lady Gaga] tall."
This gives:
But if I write:
The height of Lady Gaga is 5 feet 1 inch.
this does not compile.
On the other hand, if I write:
5 feet 1 inch specifies a height.
The height of Lady Gaga is 5 feet 1 inch.
this compiles, but gives a totally weird result:
Your best bet is probably just to write your own rule for formatting heights. Something like this, maybe:
A height is a kind of value.
2 feet 11 inches specifies a height with parts feet and inches.
To say (L - a height) in feet and inches:
let F be the feet part of L;
let I be the inches part of L;
say "[F] [if F is 1]foot[else]feet[end if] [I] [if I is 1]inch[else]inches[end if]".
After examining Gaga, say "She is [the height of Lady Gaga in feet and inches] tall."
Yeah, I skimmed over that a bit but what I think happened here is:
5 feet 11 inches (plural) specifies a height.
1 foot 1 inch (singular) specifies a height.
When written in plural, 1 feet = 12 inches. But when written singularly, 1 foot = 2 inch.
I just tested, and even with single part values, using a 1 for the singular definition isn’t necessary, so there’s no reason this might theoretically help. “2 inch (singular) specifies a height.” works fine, so this was a bit of a red herring.
Yeah, that seems like the best solution if I7 won’t do it itself, thanks!