A reckoner seed: str's text words — machines/seeds/seedstr.shoddy
seedstr bridges str’s text words
into the reckoner, Shoddy’s stack calculator: STRCAT UPPER LOWER
TRIM SPLIT JOIN TOFIXED. A seed is a short file that registers one
machine’s words with the reckoner. UPPER and
LOWER reach builtins — words the language itself supplies
— directly. The rest lean on str.shoddy,
guarded where it Errors: SPLIT on an empty
separator, and TOFIXED on a place count wide enough to overflow
the power operator underneath it.
STRCAT is not a new operation. The engine core’s own
+ is polymorphic — it adapts to whatever it is given
— and already joins two strings; STRCAT answers exactly
the same thing. It exists under its own name so the dictionary can say what
it means, rather than reach for an operator that also does arithmetic and
matrix work.
Let st0 = RckSeedStr(RckNew())
RckEval(st0, Chr(34) & "shoddy" & Chr(34) & " UPPER") ' x: "SHODDY"
RckEval(st0, Chr(34) & "a,b,c" & Chr(34) & " " & Chr(34) & "," & Chr(34) & " SPLIT") ' x: { "a" "b" "c" }
RckEval(st0, "3.14159 2 TOFIXED") ' x: "3.14"
| Word | Description |
|---|---|
| STRCAT ( a b -- ab ) | Two strings joined end to end. |
| UPPER ( s -- s ) | The string in upper case. |
| LOWER ( s -- s ) | The string in lower case. |
| TRIM ( s -- s ) | The string with leading and trailing spaces removed. |
| SPLIT ( s sep -- list ) | s cut apart everywhere sep occurs; refuses an empty separator. |
| JOIN ( list sep -- s ) | The list's strings joined together with sep between them. |
| TOFIXED ( x p -- s ) | x written with exactly p decimal places; refuses a place count that is not a whole number of 15 or fewer. |
| User | How | |
|---|---|---|
| halifax | STRCAT, SPLIT, JOIN and TOFIXED, so a string is a cell on the same stack as the numbers. | |
| sparky | Sparky folds it too, so a model calling eval reaches the same words halifax puts at a prompt. |
A mill — a complete Shoddy program — claims this seed by
folding RckSeedStr over its reckoner state. That is all halifax
does.
| Machine | Why | |
|---|---|---|
| cuttle | The Cell type; STRCAT reuses CutAdd directly. | |
| reckoner | RckReg, RckSeeding and the argument readers every registered word is built from. | |
| seq | List plumbing under the LIST-of-STRING reader JOIN shares. | |
| str | The domain this seed bridges: Trim, Split, Join and ToFixed. |