日本語 · English

cycle — parallel repeating labels (labels, not windows)

Translated from the canonical Japanese page reference/cycle.md. The source_sha above records the source revision; a consistency check flags this page when the Japanese original changes.

Category: window-generating word (premise layer) / Signature: cycle(labels) anchor: r : Stream -> Stream(labeled) / name settled (spec §5.4)

Meaning

Attaches repeating labels to a target partition window. It creates no windows — just as weekdays do not partition the days, labels are a concept parallel to windows (ADR-03). The period length is arbitrary (7, 10, 12, 60, …), and so is the target window (not only weekdays over day — it can be laid over month and year too; the twelve earthly branches are year cycle […]).

Examples

The yearly earthly branches — with 2020 (子, the Rat) as anchor, selecting New Year’s Day of a 午 (Horse) year:

# eval: 2020-01-01..2028-01-01
premise JPEto = Gregorian with {
  tz: "Asia/Tokyo"                  # needed to anchor the date literal in anchor: (ADR-33)
  yearBranch = year cycle [子, 丑, 寅, 卯, 辰, 巳, 午, 未, 申, 酉, 戌, 亥] anchor: 2020-01-01
}
@JPEto
everyDay |> within(year) |> first |> filter(d => yearBranch(d) == 午)
#=> 2026-01-01

Reading the standard weekday (Gregorian.weekday) in a predicate:

# eval: 2026-01-01..2026-01-20
@JP
everyDay |> filter(d => weekday(d) == Mon)
#=> 2026-01-05 2026-01-12 2026-01-19

Pitfalls

filter (label predicates) · table literal (data-derived labels) · the separation from WKST (stdlib/gregorian.md §4) · ADR-03/27/30.