The Machines · Runtime stack

seedjulian

A reckoner seed: the calendar as arithmetic — machines/seeds/seedjulian.shoddy

the seedjulian machine's icon

Summary

seedjulian is a seed: a small file that plugs one machine's words — its named commands — into the reckoner calculator. This one brings julian's calendar to a calculator keyboard: building a date, writing it out and reading it back, leap years and month lengths, the two epochs (the two dates a day count can start from), date arithmetic and the weekday.

These words lived in seedfin, as FINDATE and friends. In those days fin carried the calendar itself, as a stated stand-in. When the calendar moved to julian.shoddy the words moved with it, renamed JUL* to say whose they are. The day-count bases and the bond pricer stayed behind in seedfin, exactly as FinDays360 stayed in fin.

A date is a dict — a small bundle of named fields: { ("yr" n) ("mon" n) ("day" n) }. That is the same shape seedfin's dates always carried, so a date built by JULDATE flows straight into FINDAYS360 and the bond words.

Why It's Useful

Calendar questions are calculator questions: “what weekday was I born”, “how many days until”, “what is today plus ninety”. Every one of them is one line here.

Nothing here aborts. To abort is to stop the whole session with an error. julian's checked builder refuses a 30th of February by calling Error, and at a keyboard that call would end the session. So JULDATE asks JulTryOf first and turns its Err into a refusal. Every word that takes a date checks it again on the way in, since a dict can also arrive hand-built. Without those checks, the raw arithmetic would happily write 2025-02-30 out as the 2nd of March. That is a confident wrong answer — the one outcome the seed layer exists to prevent.

JULFROMSERIAL refuses a fraction — the same guard julian performs as an abort, asked first here. A number ending in .5 is usually a Julian day number on the wrong epoch, and the honest answer is a refusal that says so.

User's Guide

2026 8 12 JULDATE JULWEEKDAY
x: 3                       ' a Wednesday; Monday is 1

2026 8 12 JULDATE JULSERIAL
x: 20677                   ' days since 1970-01-01

2026 8 12 JULDATE JULDAYNUMBER
x: 2461264.5               ' what the sun and sky words take

2025 1 31 JULDATE 1 JULADDMONTHS JULDATESHOW
x: "2025-02-28"            ' clamped, not 3 March

"2025-01-31" JULDATEOF JULSERIAL
x: 20119                   ' text in, arithmetic out

And a bad date refuses, rather than ending the session:

2025 2 30 JULDATE
?: JULDATE: 2/2025 HAS 28 DAYS, SO THERE IS NO DAY 30

2451544.5 JULFROMSERIAL
?: JULFROMSERIAL needs a whole number, got 2451544.5

Word Reference

WordDescription
JULDATE ( y m d -- date )A date as a dict: yr, mon, day. Refuses anything the calendar does not have, such as the 30th of February.
JULDATESHOW ( date -- str )A date written out as "YYYY-MM-DD".
JULDATEOF ( str -- date )The other way: "2025-01-31" read back into a date.
JULISLEAP ( y -- flag )Whether a year is a leap year, century rules included.
JULDAYSINMONTH ( y m -- n )How many days that month has in that year.
JULSERIAL ( date -- n )A date as a day number, counting from 1970-01-01 — the form to subtract two dates with.
JULFROMSERIAL ( n -- date )A day number back into a date. Refuses a fraction: a number ending in .5 is usually a Julian day number on the wrong epoch.
JULDAYNUMBER ( date -- jd )The astronomical Julian day number at midnight UT (Universal Time) — always ends in .5, and it is what the geo sun words take.
JULADDDAYS ( date days -- date )The date that many days later; a negative count goes back.
JULADDMONTHS ( date months -- date )That many months later, clamped to month end: one month after 31 January is 28 February.
JULDIFF ( a b -- days )Days from a to b, signed: negative when b falls before a.
JULWEEKDAY ( date -- n )The day of the week, 1..7 with Monday 1 — the ISO convention.

Who Uses It

UserHow
halifaxFolded after seedgeo, so its words land under a -- seed-julian -- heading in WORDS.
sparkyThe same fold, and the same twelve words at a Sparky prompt.

A mill — a complete Shoddy program — claims this seed by folding RckSeedJulian over its reckoner state. Both mills append it at the end of the fold, as the fold's own comment demands. The order is chronological, and both golden suites assert it from an ordered list.

The Machines It Uses

MachineWhy
julianEvery answer. The bridge computes nothing of its own — it reads cells, calls a julian word, and writes cells back.
cuttleThe Cell type a date dict is carried in.
reckonerRckReg and RckSeeding for registration, and the argument readers that never abort.
seqMap, All, Split and Pair for reading dicts and date text apart.
strPadZero keeps "2025-02-01" zero-padded, and the text reader leans on Instr and Mid.