The Machines · Runtime stack

seedstr

A reckoner seed: str's text words — machines/seeds/seedstr.shoddy

the seedstr machine's icon

Summary

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.

Why It's Useful

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.

User's Guide

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 Reference

WordDescription
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.

Who Uses It

UserHow
halifaxSTRCAT, SPLIT, JOIN and TOFIXED, so a string is a cell on the same stack as the numbers.
sparkySparky 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.

The Machines It Uses

MachineWhy
cuttleThe Cell type; STRCAT reuses CutAdd directly.
reckonerRckReg, RckSeeding and the argument readers every registered word is built from.
seqList plumbing under the LIST-of-STRING reader JOIN shares.
strThe domain this seed bridges: Trim, Split, Join and ToFixed.