Repository navigation
Conversation
…er its name A sum consumes the key columns over= names and lands on the value columns by= names, each written after the relation, and a side left unsaid is the whole side. at reads the value columns by=rel.v names at the whole key. A partition slides along=rel.k inside the relation's groups, with within= picking the value columns. into= is gone, and so is by= on a partition. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018uvytQ8L5Kz5s5tZYpkwpp
Documentation build overview
11 files changed ·
|
…n= narrows them Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018uvytQ8L5Kz5s5tZYpkwpp
…hat the columns are Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018uvytQ8L5Kz5s5tZYpkwpp
…elations Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018uvytQ8L5Kz5s5tZYpkwpp
This was referenced Sep 17, 2026
Contributor
|
I'd never mix by and over in sum. You either state what you want to sum, or what you want to keep! |
Contributor
Author
|
Closed in favor of #540 Will revisit for syntax discussions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
The following content was generated by AI.
What this changes
A relational call names a column after the relation, and every keyword keeps one kind of value.
into=is gone, and so isby=on a partition.sum(p, by=zone_of, over=generator, into=zone)sum(p, over=zone_of.generator)[zone, period]sum(p, by=slot_of, over=generator, into=bus)sum(p, over=slot_of.generator, by=slot_of.bus)[bus, period]sum(p, by=slot_of, over=[generator, period], into=bus)sum(p, by=slot_of.bus)[bus]sum(p, by=slot_of, over=generator, into=[bus, technology])sum(p, over=slot_of.generator, by=slot_of.[bus, technology])[bus, technology, period]sum(p, by=slot_of, into=[bus, technology])sum(p, by=slot_of), or written out,by=slot_of.[bus, technology][bus, technology]sum(f, by=ends, over=line, into=bus1)sum(f, by=ends.bus1)[bus]at(cap, by=ends, over=bus0)at(cap, by=ends.bus0)[line]shift(x, along=t, by=cal, within=week)shift(x, along=cal.t, within=week)[t]position(t, by=cal)position(cal.t)tsum(p, by=gen_bus),at(price, by=gen_bus),sum(p, by=[gen_bus, gen_tech])[bus, period],[generator],[bus, technology, period]Every row operates on these declarations:
The rules, as the docs now state them:
sum(x, by=rel)consumes every key column and lands on every value column.over=rel.knarrows the key columns consumed, the rest are joined on.by=rel.vnarrows the value columns landed on. Both compose, and both name one relation. A side left unsaid is the whole side.by=slot_of.[bus, technology]lands on two columns of one relation.by=[gen_bus, gen_tech]groups through two relations at once, each walked whole, and its members are bare names, soby=[slot_of.bus, slot_of.technology]does not parse.at(x, by=rel)reads every value column at the key and lands on the whole key.by=rel.vnarrows the value columns read.shift(x, along=rel.k),sum_back(x, along=rel.k)andposition(rel.k)slide along the key columnkand group by every value column.within=vnarrows the value columns the group is made of. Nothing lands anywhere.endsholdsbus0andbus1, both overbus, and a frame carriesbusonce. Sosum(f, by=ends)andat(cap, by=ends)are refused, and the call names one:by=ends.bus1.over=rel.k, and lands on the rest of its key.over=besideby=names a column, never a dimension. A dimension is reduced by a second sum.A bare
by=relon a two-key relation now consumes both keys rather than being refused, which is the proposal's default. The sum-walks-to-the-key refusal is gone, because the shape cannot be written any more.The relation before a dot is a child node, so a macro formal binds there:
sum(x, over=r.generator, by=r.bus),at(x, by=r.bus)andshift(x, along=r.snapshot, …)all taker=at the call. The resolved tree keeps the shape the program reads today, so lowering, the dim check and the typesetter are unchanged, and the golden.outfiles move only in one legend line.Why
Two keywords for one direction, with the table named in a third, made the relational calls hard to read, and
over=meant a dimension in one call and a column in the next. Writing the column after the relation shows what is consumed and what is landed on, lets the two compose (the one case #509 could not write), and keeps every guard main already has: distinct columns over one dimension, the list rules, the joined-dimension check and formal binding.Refusals, each naming the rewrite
sum(p, by=slot_of, over=period):beside by=, over= names the key columns the sum consumes, written after the relation: over=slot_of.<key column>. To reduce a dimension as well, sum twice: sum(sum(…, by=slot_of), over=period).sum(p, over=slot_of.generator, by=gen_bus.bus):names two relations, and one sum walks one relation. Name the same relation on both sides, or group through several with by=[slot_of, gen_bus].sum(p, over=slot_of.bus):over=slot_of.bus names ['bus'], which is not a key column of 'slot_of' — its key columns are ['generator', 'period']. Name key columns here, and the other side with by=slot_of.<value column>.sum(f, by=ends):lands on ['bus0', 'bus1'], two columns over ['bus'], and a frame carries each dimension once, so nothing says which column its coordinate is read at. Name one: by=ends.bus0.sum(x, by=conn)on a bare relation:nothing says which columns the sum consumes and which it lands on. Write over=conn.<column> among […] to consume some, or declare the columns it lands on under value:.at(q, by=lk.g):by=lk.g names ['g'], which is not a value column of 'lk' — its value columns are ['h'].shift(x, along=t, within=week):along= names a dimension, not a relation. Write along=<relation>.<key column> to slide inside its groups, or drop within=.shift(x, along=cal.week):'week' is a value column of 'cal', and a partition slides along a key column — its key is ['t'].position(cal):To count inside the groups of a relation, write position(cal.<key column>).names columns of an expression, and columns belong to a relation.into=,over=onat,by=on a partition: the closed call shape.Guards and their tests
Each of the nineteen new guards in
resolution.pywas neutralised in turn and itstest_validation.pycase run; every one failed without its guard. The list: over= beside a bracketed by=, a plain dimension beside by=, two relations, the key side and the value side of a sum, both bare-relation refusals, distinct columns consumed and landed on, the read's bare, side and distinct checks, within= beside a plain dimension, along= naming several columns, the partition's bare, key-column, unknown-column and key-column-in-within checks, and position on a name that is not a relation.Coverage moved:
a-sum-that-walks-to-the-key-is-a-readis deleted, since the shape cannot be written.by-a-two-key-relation-without-frombecamea-plain-dimension-beside-by, since a bareby=on a two-key relation now loads.Verified
pixiis not installable in this session (the installer is blocked by the proxy with a 403), so the gates ran from auvvenv on Python 3.13 with the pinnedruff==0.16.1andpyrefly==1.2.0:pytest -q -n 4: 1302 passed, 1 skipped (the whole suite,test_docs.pyincluded).ruff check,ruff format --check: clean.pyrefly check: 0 errors.prettier --checkon docs, examples and the README: clean.tests.typesetting.golden,tools.notation,tools.spec_math,tools.gallery,tools.home_math,tools.schema. The.outfiles move in one legend line,shift(along=relation.d)forshift(by=relation); the math is unchanged.mkdocs build: no link or anchor warnings.--strictaborts here on fetchingdocs.python.org/objects.invthrough the proxy, which is the environment, not a page.Not run:
pixi run cias one command,typos,reuse lint,zizmor,taplo,compile-tex.Deliberately not done: the bracket form
param[R.valuecol](the follow-up the author named), a dotted member insideby=[a, b](a parse error, as before), andWalk.is_function_read, which is removed since nothing calls it.🤖 Generated with Claude Code
https://claude.ai/code/session_018uvytQ8L5Kz5s5tZYpkwpp