A reckoner seed: money's exact currency — machines/seeds/seedmoney.shoddy
seedmoney bridges money's exact
currency — amounts kept to the cent, with no rounding drift:
MONEY builds a MONEY cell from a
NUMBER of dollars.MADD and MSUB name the same arithmetic the
engine core's polymorphic + and - (one word,
working across several cell types) already give money cells. They exist
for a dictionary that wants to say what it means.MSPLIT allocates a MONEY into n parts
without losing a penny.MFMT is the exact string RckShow already
renders a MONEY cell as, for a program that wants the text
itself rather than the display.A calculator that only ever prints its own display cannot hand a
formatted total to another word — a report line, a saved file, a
concatenated string. MFMT is that seam. It is the same
rendering RckShow uses, handed back as an ordinary value.
Let st0 = RckSeedMoney(RckNew())
RckEval(st0, "1234.56 MONEY") ' x: $1,234.56
RckEval(st0, "MFMT") ' x: "$1,234.56"
RckEval(st0, "1234.56 MONEY 3 MSPLIT") ' x: { $411.52 $411.52 $411.52 } — no penny lost
| Word | Description |
|---|---|
| MONEY ( x -- money ) | x dollars, as exact currency to the cent. |
| MADD ( a b -- a+b ) | Two MONEY cells added exactly. |
| MSUB ( a b -- a-b ) | Two MONEY cells subtracted exactly. |
| MSPLIT ( m n -- list ) | m divided into n MONEY shares, no penny created or lost; refuses a share count below one. |
| MFMT ( money -- s ) | A MONEY cell formatted as text, e.g. $1,234.56. |
| User | How | |
|---|---|---|
| halifax | MONEY, MSPLIT and MFMT — exact cents at the prompt, and a split that conserves the penny. | |
| sparky | Sparky folds it too, so a model calling eval reaches the same words halifax puts at a prompt. |
A mill claims this seed by folding RckSeedMoney over its reckoner
state, which is all halifax does.
| Machine | Why | |
|---|---|---|
| cuttle | The CutMoney case every word here reads and answers. | |
| money | The domain this seed bridges: Dollars, MoneyAdd, MoneySub, MoneySplit and MoneyFmt. | |
| reckoner | RckReg, RckSeeding and the argument readers every registered word is built from. |