lagoon: fix reduction-jet result shape to match +scalar-to-ray#68
Merged
Conversation
…anks) The i754 reduction jets boxed their scalar result with a hardcoded shape that was correct for only one rank: min/max used ~[1 1] (wrong for a rank-1 vector), dot used ~[len 1], and cumsum used ~[1] (wrong for a rank-2 matrix). The Hoon +scalar-to-ray boxes to an all-1s shape of the INPUT's rank (reap (lent shape) 1), so e.g. (min vector) should be ~[1], not ~[1 1] -- a silent jet/Hoon mismatch on the meta. Add a _la_scalar_box helper (all-1s of the input rank) and route cumsum, min, max, and dot through it, so the boxed shape matches the Hoon for every rank. trace (always rank-2) and diag (returns a vector, not a scalar) are unaffected and left as-is. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sigilante
added a commit
to urbit/vere
that referenced
this pull request
Jun 29, 2026
Rename the rank-correct boxing helper introduced for %int2 (_la_int2_box -> _la_scalar_box, it was already kind-neutral) and route the i754 cumsum/min/max/dot cases through it too, so their boxed scalar result matches the Hoon +scalar-to-ray (all-1s of the input rank) instead of the prior hardcoded ~[1 1] / ~[len 1] / ~[1]. Carries urbit/numerics#68 into the runtime. trace (always rank-2) keeps ~[1 1] and is unaffected. Verified on a hoon-135 fakezod: i754 min/max/cumsum/dot now match the unjetted Hoon (were mismatched on the boxed shape), and the %int2 reductions still match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sigilante
added a commit
to urbit/vere
that referenced
this pull request
Jun 29, 2026
Rename the rank-correct boxing helper introduced for %int2 (_la_int2_box -> _la_scalar_box, it was already kind-neutral) and route the i754 cumsum/min/max/dot cases through it too, so their boxed scalar result matches the Hoon +scalar-to-ray (all-1s of the input rank) instead of the prior hardcoded ~[1 1] / ~[len 1] / ~[1]. Carries urbit/numerics#68 into the runtime. trace (always rank-2) keeps ~[1 1] and is unaffected. Verified on a hoon-135 fakezod: i754 min/max/cumsum/dot now match the unjetted Hoon (were mismatched on the boxed shape), and the %int2 reductions still match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sigilante
added a commit
that referenced
this pull request
Jun 29, 2026
Mirror the vere change (urbit/vere): Lagoon %int2 cases for gth/gte/lth/lte, cumsum, dot, min/max, argmin/argmax -- native per-lane two's-complement, signed compares via the matching signed C type, scalar reductions boxed per +scalar-to-ray. Reuses the _la_scalar_box helper added by #68 (forward-index argmin/argmax and the rank-correct scalar shape), so int2 and i754 reductions share one boxing helper. Verified jet == %int2 Hoon on a hoon-135 fakezod. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
The i754 reduction jets box their scalar result with a hardcoded ray shape that's correct for only one rank, so the jet silently disagrees with the Hoon on the result meta:
+scalar-to-ray(Hoon)min/max~[1 1]~[1]for a vectordot~[len 1]~[1]for rank-1 inputscumsum~[1]+scalar-to-raysets the shape to(reap (lent shape) 1)— all-1s of the input's rank. The fix adds a_la_scalar_boxhelper (all-1s of rank) and routescumsum/min/max/dotthrough it, matching the Hoon for every rank.trace(always rank-2 →~[1 1]) anddiag(returns a vector,~[len 1]) are correct as-is and untouched.Found while jetting the
%int2reductions (#67): the%int2path already boxes via the rank-correct shape and matches its Hoon; this brings the i754 (and any other scalar-reducing) path in line. The data/value is unchanged — only the boxed meta shape is corrected.🤖 Generated with Claude Code